Created
February 4, 2016 23:32
-
-
Save iondune/0c27553d46b1616d560f to your computer and use it in GitHub Desktop.
OpengL debugging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, true); | |
| void GLAPIENTRY DebugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * message, void const * userParam) | |
| { | |
| string Source = ""; | |
| string Type = ""; | |
| string Severity = ""; | |
| switch (source) | |
| { | |
| default: | |
| Source = "???"; | |
| break; | |
| case GL_DEBUG_SOURCE_API: | |
| Source = "API"; | |
| break; | |
| case GL_DEBUG_SOURCE_WINDOW_SYSTEM: | |
| Source = "Window System"; | |
| break; | |
| case GL_DEBUG_SOURCE_SHADER_COMPILER: | |
| Source = "Shader Compiler"; | |
| break; | |
| case GL_DEBUG_SOURCE_THIRD_PARTY: | |
| Source = "Third Party"; | |
| break; | |
| case GL_DEBUG_SOURCE_APPLICATION: | |
| Source = "Application"; | |
| break; | |
| case GL_DEBUG_SOURCE_OTHER: | |
| Source = "Other"; | |
| break; | |
| } | |
| switch (type) | |
| { | |
| default: | |
| Type = "???"; | |
| break; | |
| case GL_DEBUG_TYPE_ERROR: | |
| Type = "Error"; | |
| break; | |
| case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: | |
| Type = "Deprecated Behavior"; | |
| break; | |
| case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: | |
| Type = "Undefined Behavior"; | |
| break; | |
| case GL_DEBUG_TYPE_PORTABILITY: | |
| Type = "Portability"; | |
| break; | |
| case GL_DEBUG_TYPE_PERFORMANCE: | |
| Type = "Performance"; | |
| break; | |
| case GL_DEBUG_TYPE_OTHER: | |
| Type = "Other"; | |
| break; | |
| case GL_DEBUG_TYPE_MARKER: | |
| Type = "Marker"; | |
| break; | |
| case GL_DEBUG_TYPE_PUSH_GROUP: | |
| Type = "Push Group"; | |
| break; | |
| case GL_DEBUG_TYPE_POP_GROUP: | |
| Type = "Pop Group"; | |
| break; | |
| } | |
| switch (severity) | |
| { | |
| default: | |
| Severity = "???"; | |
| break; | |
| case GL_DEBUG_SEVERITY_HIGH: | |
| Severity = "High"; | |
| break; | |
| case GL_DEBUG_SEVERITY_MEDIUM: | |
| Severity = "Medium"; | |
| break; | |
| case GL_DEBUG_SEVERITY_LOW: | |
| Severity = "Low"; | |
| break; | |
| case GL_DEBUG_SEVERITY_NOTIFICATION: | |
| Severity = "Notification"; | |
| break; | |
| } | |
| Log::Info("OpenGL Debug Message [%s/%s/%s]: %s", Source, Type, Severity, message); | |
| } | |
| CheckedGLCall(glDebugMessageCallback(DebugMessageCallback, nullptr)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment