void initialize() { if(!isEnabled()) { return; } bool have_debug = ARX_HAVE_GL_VER(4, 3) || ARX_HAVE_GL_EXT(KHR_debug); #if ARX_HAVE_EPOXY have_debug = have_debug || (epoxy_is_desktop_gl() && ARX_HAVE_GL_EXT(ARB_debug_output)); #endif if(!have_debug) { LogWarning << "OpenGL debug output not available"; return; } glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); // GLEW versions before 1.11.0 define GLDEBUGPROC with a non-const user pointer #if !ARX_HAVE_GLEW || defined(GLEW_VERSION_4_5) glDebugMessageCallback(gldebug::callback, NULL); #else glDebugMessageCallback((GLDEBUGPROC)gldebug::callback, NULL); #endif // Forward messages with high severity level glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_HIGH, 0, NULL, GL_TRUE); // Forward messages with medium severity level glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_MEDIUM, 0, NULL, GL_TRUE); // Forward messages from the application glDebugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE); std::string strInitialized("OpenGL debug output enabled"); glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 1, GL_DEBUG_SEVERITY_LOW, GLsizei(strInitialized.size()), strInitialized.c_str()); }
void initialize() { if(!isEnabled()) { return; } if(!GLEW_ARB_debug_output) { LogWarning << "OpenGL debug output disabled"; return; } glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); // GLEW versions before 1.11.0 define GLDEBUGPROCARB with a non-const user pointer #if defined(GLEW_VERSION_4_5) glDebugMessageCallbackARB(gldebug::callback, NULL); #else glDebugMessageCallbackARB((GLDEBUGPROCARB)gldebug::callback, NULL); #endif // Forward messages with high severity level glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_HIGH_ARB, 0, NULL, GL_TRUE); // Forward messages with medium severity level glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_MEDIUM_ARB, 0, NULL, GL_TRUE); // Forward messages from the application glDebugMessageControlARB(GL_DEBUG_SOURCE_APPLICATION_ARB, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE); std::string strInitialized("OpenGL debug output enabled"); glDebugMessageInsertARB(GL_DEBUG_SOURCE_APPLICATION_ARB, GL_DEBUG_TYPE_OTHER_ARB, 1, GL_DEBUG_SEVERITY_LOW_ARB, GLsizei(strInitialized.size()), strInitialized.c_str()); }