Created
June 3, 2014 23:34
-
-
Save iondune/dee4c7a196ce499dc87b to your computer and use it in GitHub Desktop.
print opengl errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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