KrisLibrary  1.0.0
GLError.h
1 #ifndef GLDRAW_GL_ERROR_H
2 #define GLDRAW_GL_ERROR_H
3 
4 #include <KrisLibrary/Logger.h>
5 #include "GL.h"
6 
7 //Returns the string corresponding to the GL error code err
8 const char* GLErrorString(GLenum err);
9 
10 //Checks for GL errors, prints them with the header string name,
11 //pauses if pause=true. Returns false if no error occurred.
12 bool CheckGLErrors(const char* name="GL error",bool pause=true);
13 
14 #define GL_ERROR_QUIT 0
15 #define DEBUG_GL_ERRORS() { \
16  GLenum err; \
17  while((err=glGetError()) != GL_NO_ERROR) { \
18  LOG4CXX_ERROR(KrisLibrary::logger(),"glError "<<GLErrorString(err)<<" found at "<<__FILE__<<":"<<__LINE__); \
19  if(GL_ERROR_QUIT) exit(1); \
20  } \
21 }
22 
23 #endif
The logging system used in KrisLibrary.