Skip to content

Instantly share code, notes, and snippets.

@nlguillemot
Created December 19, 2014 17:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nlguillemot/b1981969b07295376674 to your computer and use it in GitHub Desktop.
Save nlguillemot/b1981969b07295376674 to your computer and use it in GitHub Desktop.
utility function to convert GLenum error codes to strings like gluErrorString
const char* GLErrorToString(GLenum err)
{
switch (err)
{
case GL_NO_ERROR: return "GL_NO_ERROR";
case GL_INVALID_ENUM: return "GL_INVALID_ENUM";
case GL_INVALID_VALUE: return "GL_INVALID_VALUE";
case GL_INVALID_OPERATION: return "GL_INVALID_OPERATION";
case GL_STACK_OVERFLOW: return "GL_STACK_OVERFLOW";
case GL_STACK_UNDERFLOW: return "GL_STACK_UNDERFLOW";
case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY";
case 0x8031: /* not core */ return "GL_TABLE_TOO_LARGE_EXT";
case 0x8065: /* not core */ return "GL_TEXTURE_TOO_LARGE_EXT";
case GL_INVALID_FRAMEBUFFER_OPERATION: return "GL_INVALID_FRAMEBUFFER_OPERATION";
default:
assert(!"Unhandled GL error code");
return NULL;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment