Skip to content

Instantly share code, notes, and snippets.

@vinjn
Last active December 15, 2015 21:19
Show Gist options
  • Save vinjn/5325366 to your computer and use it in GitHub Desktop.
Save vinjn/5325366 to your computer and use it in GitHub Desktop.
#ifdef _DEBUG
static void CheckGLError(const char *file, int line, const char *func)
{
int err=0;
char msg[256];
while( (err=_glGetError())!=0 )
{
sprintf(msg, "%s(%d) : [%s] GL_ERROR=0x%x\n", file, line, func, err);
#ifdef WIN32
OutputDebugStringA(msg);
#endif
fprintf(stderr, msg);
}
}
# ifdef __FUNCTION__
# define CHECK_GL_ERROR CheckGLError(__FILE__, __LINE__, __FUNCTION__)
# else
# define CHECK_GL_ERROR CheckGLError(__FILE__, __LINE__, "")
# endif
#else
# define CHECK_GL_ERROR ((void)(0))
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment