Skip to content

Instantly share code, notes, and snippets.

@KageKirin
Created July 1, 2020 04:25
Show Gist options
  • Select an option

  • Save KageKirin/ded495258709498351f4288a93576066 to your computer and use it in GitHub Desktop.

Select an option

Save KageKirin/ded495258709498351f4288a93576066 to your computer and use it in GitHub Desktop.
Safe OpenGL call
#define SAFEGL(call) (call); \
{\
GLenum err = glGetError(); \
if (err != GL_NO_ERROR) \
fprintf(stdout, "GL ERROR: 0x%x at '%s' %s:%d\n", err, #call, __FILE__, __LINE__);\
}\
@KageKirin
Copy link
Author

This is a simple wrapper around OpenGL calls that helps with finding errors at the call site.

Usage:

SAFEGL( glGenTextures(1, &s_screenTexture) );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment