GL: Test for GL_KHR_debug before enabling GL_DEBUG_OUTPUT

The GLEW headers of Ubuntu 12.04 LTS don't know about GL_KHR_debug yet,
so we have to test for it before using its enum. Additionally, drivers
without support for GL_KHR_debug would emit INVALID_ENUM, so we test for
driver support too.
Controls
Nicolas Hake 2015-05-28 22:56:48 +02:00
parent 0f65ab4b35
commit 0db5950c8d
1 changed files with 4 additions and 1 deletions

View File

@ -220,7 +220,10 @@ CStdGLCtx *CStdGL::CreateContext(C4Window * pWindow, C4AbstractApp *pApp)
DebugLog(" gl: Setting OpenGLDebugProc callback");
glDebugMessageCallbackARB(&OpenGLDebugProc, nullptr);
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
glEnable(GL_DEBUG_OUTPUT);
#ifdef GL_KHR_debug
if (GLEW_KHR_debug)
glEnable(GL_DEBUG_OUTPUT);
#endif
}
// First context: Log some information about hardware/drivers
// Must log after context creation to get valid results