Project Alice
Loading...
Searching...
No Matches
opengl_wrapper_nix.cpp
Go to the documentation of this file.
1#include <GL/glew.h>
2#include <string>
3
4namespace ogl {
5
7 assert(state.win_ptr && state.win_ptr->window);
8
9 glfwMakeContextCurrent(state.win_ptr->window);
10 glfwSwapInterval(1); // Vsync option
11
12 if(glewInit() != GLEW_OK) {
13 window::emit_error_message("GLEW failed to initialize", true);
14 }
15#ifndef NDEBUG
16 glEnable(GL_DEBUG_OUTPUT);
17 glDebugMessageCallback(debug_callback, nullptr);
18 glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE);
19 glDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_OTHER, GL_DEBUG_SEVERITY_LOW, 0, nullptr, GL_FALSE);
20#endif
21}
22
24} // namespace ogl
#define assert(condition)
Definition: debug.h:74
Definition: color.hpp:6
void create_opengl_context(sys::state &state)
void shutdown_opengl(sys::state &state)
void debug_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei, GLchar const *message, void const *)
void emit_error_message(std::string const &content, bool fatal)
Definition: window_nix.cpp:355