Skip to content

Instantly share code, notes, and snippets.

@Robadob
Created March 24, 2016 09:21
Show Gist options
  • Save Robadob/a9de4ff440dca6943268 to your computer and use it in GitHub Desktop.
Save Robadob/a9de4ff440dca6943268 to your computer and use it in GitHub Desktop.
#ifdef _DEBUG //VS standard debug flag
inline static void HandleGLError(const char *file, int line) {
GLuint error = glGetError();
if (error != GL_NO_ERROR)
{
printf("%s(%i) GL Error Occurred;\n%s\n", file, line, gluErrorString(error));
#if EXIT_ON_ERROR
getchar();
exit(1);
#endif
}
}
#define GL_CALL( err ) err ;HandleGLError(__FILE__, __LINE__)
#define GL_CHECK() (HandleGLError(__FILE__, __LINE__))
#else //ifdef _DEBUG
//Remove the checks when running release mode.
#define GL_CALL( err ) err
#define GL_CHECK()
#endif //ifdef _DEBUG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment