35 virtual const char*
what()
const throw() {
36 return whatStr.c_str();
76#define MAX_GL_ERROR_COUNT 10
86void errorOut(
const std::string& statement,
const std::string& location,
87 uint32_t line,
const std::string& file, uint32_t errnum);
104uint32_t counter = 0; \
105while((glerr = glGetError()) != GL_NO_ERROR) { \
106errorOut(#stmt, "before", __LINE__, __FILE__, \
107static_cast<uint32_t>(glerr)); \
109if (counter > MAX_GL_ERROR_COUNT) break; \
113while((glerr = glGetError()) != GL_NO_ERROR) { \
114errorOut(#stmt, "in", __LINE__, __FILE__, \
115static_cast<uint32_t>(glerr)); \
117if (counter > MAX_GL_ERROR_COUNT) break; \
123# define GL(stmt) do { stmt; } while(0)
std::string errorString(GLenum glerr)
Convert a GL error enum to a short string (e.g., "GL_INVALID_VALUE").
Definition GLDebug.cpp:7
void errorOut(const std::string &statement, const std::string &location, uint32_t line, const std::string &file, uint32_t errnum)
Internal printer used by the GL() macro to emit formatted errors.
Definition GLDebug.cpp:19
void checkAndThrow()
Throw a GLException if glGetError() reports an error.
Definition GLDebug.cpp:25
void checkAndThrowShader(GLuint shader)
Check a shader object's compile status and throw with its log on error.
Definition GLDebug.cpp:34
void checkAndThrowProgram(GLuint program)
Check a program object's link status and throw with its log on error.
Definition GLDebug.cpp:48
virtual const char * what() const
Retrieve the explanatory C-string.
Definition GLDebug.h:35
GLException(const std::string &whatStr)
Construct with an explanatory message.
Definition GLDebug.h:33
Simple pixel/viewport dimensions with an aspect ratio helper.
Definition GLDebug.h:45
uint32_t height
Height in pixels/texels.
Definition GLDebug.h:47
float aspect() const
Aspect ratio as width/height.
Definition GLDebug.h:53
uint32_t width
Width in pixels/texels.
Definition GLDebug.h:46