Enable OpenGL debug output in debug builds

This commit is contained in:
Maciej Suminski 2018-02-09 16:19:25 +01:00
parent 6dbd7a8d73
commit 8a68a21570
2 changed files with 13 additions and 1 deletions

View File

@ -1774,6 +1774,10 @@ void OPENGL_GAL::init()
GLenum err = glewInit(); GLenum err = glewInit();
#ifdef __WXDEBUG__
enableGlDebug( true );
#endif
try try
{ {
if( GLEW_OK != err ) if( GLEW_OK != err )

View File

@ -88,7 +88,15 @@ int checkGlError( const std::string& aInfo, bool aThrow )
static void GLAPIENTRY debugMsgCallback( GLenum aSource, GLenum aType, GLuint aId, static void GLAPIENTRY debugMsgCallback( GLenum aSource, GLenum aType, GLuint aId,
GLenum aSeverity, GLsizei aLength, const GLchar* aMessage, const void* aUserParam ) GLenum aSeverity, GLsizei aLength, const GLchar* aMessage, const void* aUserParam )
{ {
printf( "%s", aMessage ); switch( aSeverity )
{
case GL_DEBUG_SEVERITY_HIGH: printf( "OpenGL ERROR: " ); break;
case GL_DEBUG_SEVERITY_MEDIUM: printf( "OpenGL WARNING: " ); break;
case GL_DEBUG_SEVERITY_LOW: printf( "OpenGL INFO: " ); break;
case GL_DEBUG_SEVERITY_NOTIFICATION: return;
}
printf( "%s\n", aMessage );
} }