src/opengl.cpp in rays-0.1.28 vs src/opengl.cpp in rays-0.1.29

- old
+ new

@@ -6,14 +6,14 @@ namespace Rays { - GLenum - OpenGL_get_error () + bool + OpenGL_has_error () { - return glGetError(); + return glGetError() != GL_NO_ERROR; } static String get_error_name (GLenum error) { @@ -22,25 +22,39 @@ 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_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY"; - #ifndef IOS + #if !defined(GL_VERSION_3_0) case GL_STACK_OVERFLOW: return "GL_STACK_OVERFLOW"; case GL_STACK_UNDERFLOW: return "GL_STACK_UNDERFLOW"; + case GL_INVALID_FRAMEBUFFER_OPERATION: return "GL_INVALID_FRAMEBUFFER_OPERATION"; + case GL_TABLE_TOO_LARGE: return "GL_TABLE_TOO_LARGE"; #endif - case 0x506: return "GL_INVALID_FRAMEBUFFER_OPERATION"; - case 0x8031: return "GL_TABLE_TOO_LARGE"; default: return "UNKNOWN ERROR"; } } void OpenGL_check_error (const char* file, int line) { - GLenum e = OpenGL_get_error(); + GLenum e = glGetError(); if (e != GL_NO_ERROR) opengl_error(file, line, "OpenGL error %s", get_error_name(e).c_str()); + } + + void + OpenGL_check_error (const char* file, int line, const char* format, ...) + { + XOT_STRINGF(format, s); + + GLenum e = glGetError(); + if (e != GL_NO_ERROR) + { + opengl_error( + file, line, + "OpenGL error %s: %s", get_error_name(e).c_str(), s.c_str()); + } } }// Rays