Skip to content

Instantly share code, notes, and snippets.

@preble
Created October 24, 2012 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save preble/3946220 to your computer and use it in GitHub Desktop.
Save preble/3946220 to your computer and use it in GitHub Desktop.
glGetError() test macro
// A macro I wrote a few years back to assist in checking OpenGL error codes.
// Add to a .h or at the top of your implementation file:
#define GLERR do {\
GLuint glerr;\
while((glerr = glGetError()) != GL_NO_ERROR)\
fprintf(stderr, "%s:%d glGetError() = 0x%04x", __FILE__, __LINE__, glerr);\
} while (0)
// Sprinkle in "GLERR;" after failure-prone OpenGL calls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment