Example/OpenGL Error Testing with Message Callbacks: Difference between revisions
< Example
Jump to navigation
Jump to search
Dark Photon (talk | contribs) (Created page with "A simple example of how to utilize debug message callbacks (e.g. for detecting OpenGL errors): <source lang=cpp> void MessageCallback( GLenum source, GL...") |
Dark Photon (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
A simple example | A simple example showing how to utilize debug message callbacks (e.g. for detecting OpenGL errors): | ||
<source lang=cpp> | <source lang=cpp> |
Revision as of 04:43, 13 January 2018
A simple example showing how to utilize debug message callbacks (e.g. for detecting OpenGL errors):
void MessageCallback( GLenum source,
GLenum type,
GLuint id,
GLenum severity,
GLsizei length,
const GLchar* message,
const void* userParam )
{
fprintf( stderr, "GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s\n",
( type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : "" ),
type, severity, message );
}
// During init, enable debug output
glEnable ( GL_DEBUG_OUTPUT );
glDebugMessageCallback( (GLDEBUGPROC) MessageCallback, 0 );