12 OpenGLWindow::OpenGLWindow(
int width,
int height,
const char* title) noexcept
14 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
15 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
16 glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
17 glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
19 windowReference = eastl::shared_ptr<Window>(
new Window(width, height, title));
21 window = windowReference->GetGLFWWindow().lock();
22 this->width = windowReference->GetWidth();
23 this->displayWidth = windowReference->GetDisplayWidth();
24 this->displayHeight = windowReference->GetDisplayHeight();
25 this->height = windowReference->GetHeight();
26 this->title = windowReference->GetTitle();
28 int major = glfwGetWindowAttrib(window.get(), GLFW_CONTEXT_VERSION_MAJOR);
29 int minor = glfwGetWindowAttrib(window.get(), GLFW_CONTEXT_VERSION_MINOR);
30 int revision = glfwGetWindowAttrib(window.get(), GLFW_CONTEXT_REVISION);
31 debug_info(
"OpenGLWindow",
"Constructor", eastl::string(eastl::string(
"OpenGL Version ") + std::to_string(major).c_str() +
"." + std::to_string(minor).c_str() +
"." + std::to_string(revision).c_str()));
33 glfwMakeContextCurrent(window.get());
36 glewExperimental =
true;
37 GLenum glewError = glewInit();
38 if (glewError != GLEW_OK)
40 debug_error(
"OpenGLWindow",
"Constructor",
"Failed to initialize OpenGL context");
44 glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
46 glEnable(GL_DEPTH_TEST);
50 glEnable(GL_CULL_FACE);
53 OpenGLWindow::~OpenGLWindow() noexcept
#define debug_error(debug_class, function, value)
This functions logs a debug error to the log and console. This does not halt the program! ...
#define debug_info(debug_class, function, value)
This functions logs a debug info to the log and console. Use this for useless information.