OpenGL driver debug routines

This commit is contained in:
Maciej Suminski 2017-08-04 10:07:39 +02:00
parent 2d9ab80b4e
commit 46b5575c51
3 changed files with 28 additions and 0 deletions

View File

@ -340,6 +340,8 @@ void OPENGL_GAL::BeginDrawing()
wxLogTrace( "GAL_PROFILE",
wxT( "OPENGL_GAL::BeginDrawing(): %.1f ms" ), totalRealTime.msecs() );
#endif /* __WXDEBUG__ */
//enableGlDebug( true );
}

View File

@ -82,3 +82,23 @@ int checkGlError( const std::string& aInfo, bool aThrow )
return result;
}
static void debugMsgCallback( GLenum aSource, GLenum aType, GLuint aId,
GLenum aSeverity, GLsizei aLength, const GLchar* aMessage, const void* aUserParam)
{
printf( "%s", aMessage );
}
void enableGlDebug( bool aEnable )
{
if( aEnable )
{
glEnable( GL_DEBUG_OUTPUT );
glDebugMessageCallback( debugMsgCallback, nullptr );
}
else
{
glDisable( GL_DEBUG_OUTPUT );
}
}

View File

@ -36,4 +36,10 @@
*/
int checkGlError( const std::string& aInfo, bool aThrow = true );
/**
* @brief Enables/disables OpenGL driver messages output.
* @param aEnable decides whether the message should be shown.
*/
void enableGlDebug( bool aEnable );
#endif /* __OPENGL_ERROR_H */