medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit d2d21710aeda778cb560be1822acdd586f62eab6
parent 58e90c9730426b75d43c8a0ee38676cb16cb7556
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Mon Oct 24 18:23:18 +0300

Properly initialise GL_DEBUG_OUTPUT, ignore spammy warnings

Diffstat:
gl.cc | 24+++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/gl.cc b/gl.cc @@ -46,10 +46,14 @@ static const char * severity_string( GLenum severity ) { } } -static void gl_error_printer( +static void gl_debug_output_callback( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * message, const void * _ ) { + if( id == 131169 || id == 131185 || id == 131218 || id == 131204 ) { + return; + } + // we don't want the trailing \n size_t len = strlen( message ); if( len > 0 && message[ len - 1 ] == '\n' ) { @@ -67,12 +71,12 @@ static void gl_error_printer( } #endif -static void glfw_error_printer( int code, const char * message ) { +static void glfw_error_callback( int code, const char * message ) { WARN( "GLFW error %d: %s", code, message ); } GLFWwindow * gl_init() { - glfwSetErrorCallback( glfw_error_printer ); + glfwSetErrorCallback( glfw_error_callback ); if( !glfwInit() ) { FATAL( "glfwInit" ); @@ -98,16 +102,14 @@ GLFWwindow * gl_init() { FATAL( "gladLoadGL" ); } -#if !defined( _WIN32 ) - if( GLAD_GL_ARB_debug_output ) { + GLint context_flags; + glGetIntegerv( GL_CONTEXT_FLAGS, &context_flags ); + if( context_flags & GL_CONTEXT_FLAG_DEBUG_BIT ) { glEnable( GL_DEBUG_OUTPUT ); - glDebugMessageCallbackARB( ( GLDEBUGPROCARB ) gl_error_printer, NULL ); + glEnable( GL_DEBUG_OUTPUT_SYNCHRONOUS ); + glDebugMessageCallbackARB( ( GLDEBUGPROCARB ) gl_debug_output_callback, NULL ); + glDebugMessageControl( GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE ); } - else if( GLAD_GL_KHR_debug ) { - glEnable( GL_DEBUG_OUTPUT ); - glDebugMessageCallback( ( GLDEBUGPROC ) gl_error_printer, NULL ); - } -#endif INFO( "Version %s", glGetString( GL_VERSION ) ); INFO( "Vendor %s", glGetString( GL_VENDOR ) );