NoJobEngine 2.0.7
Loading...
Searching...
No Matches
OpenGLContext.cpp
Go to the documentation of this file.
2#include <glad/gl.h>
3#include <GLFW/glfw3.h>
4#include <iostream>
5#include <stdexcept>
6
7namespace NoJob {
8void OpenGLContext::Init(GLFWwindow* window) {
9 glfwMakeContextCurrent(window);
10
11 const int version = gladLoadGL(
12 reinterpret_cast<GLADloadfunc>(glfwGetProcAddress));
13
14 if (version == 0)
15 throw std::runtime_error("NoJobEngine: GLAD failed to load OpenGL.");
16
17 std::cout << "NoJobEngine OpenGL context\n"
18 << "Vendor: " << glGetString(GL_VENDOR) << '\n'
19 << "Renderer: " << glGetString(GL_RENDERER) << '\n'
20 << "Version: " << glGetString(GL_VERSION) << '\n';
21}
22}
OpenGLContext declarations for the OpenGL Backend subsystem.
static void Init(GLFWwindow *window)