Skip to content

Instantly share code, notes, and snippets.

@iondune
Created June 3, 2014 23:34
Show Gist options
  • Select an option

  • Save iondune/dee4c7a196ce499dc87b to your computer and use it in GitHub Desktop.

Select an option

Save iondune/dee4c7a196ce499dc87b to your computer and use it in GitHub Desktop.
print opengl errors
void PrintOpenGLErrors(c8 const * const Function, c8 const * const File, s32 const Line);
#ifdef _DEBUG
#define CheckedGLCall(x) do { PrintOpenGLErrors("before "#x, __FILE__, __LINE__); (x); PrintOpenGLErrors(#x, __FILE__, __LINE__); } while (0)
#else
#define CheckedGLCall(x) (x)
#endif
void PrintOpenGLErrors(char const * const Function, char const * const File, int const Line)
{
bool Succeeded = true;
GLenum Error = glGetError();
if (Error != GL_NO_ERROR)
{
char const * ErrorString = (char const *) gluErrorString(Error);
std::cerr << "OpenGL Error in " << File << " at line " << Line << " calling function " << Function << ": " << (ErrorString ? ErrorString : "") << std::endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment