Added a helper function that prints opengl errors
This commit is contained in:
parent
be2e86166f
commit
ecd5445eed
@ -765,5 +765,49 @@ else \
|
||||
#endif // ifdef XX
|
||||
} // getGLLimits
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Executes glGetError and prints error to the console
|
||||
* \return True if error ocurred
|
||||
*/
|
||||
bool checkGLError()
|
||||
{
|
||||
GLenum err = glGetError();
|
||||
|
||||
switch (err)
|
||||
{
|
||||
case GL_NO_ERROR:
|
||||
break;
|
||||
case GL_INVALID_ENUM:
|
||||
Log::warn("GLWrap", "glGetError: GL_INVALID_ENUM");
|
||||
break;
|
||||
case GL_INVALID_VALUE:
|
||||
Log::warn("GLWrap", "glGetError: GL_INVALID_VALUE");
|
||||
break;
|
||||
case GL_INVALID_OPERATION:
|
||||
Log::warn("GLWrap", "glGetError: GL_INVALID_OPERATION");
|
||||
break;
|
||||
case GL_INVALID_FRAMEBUFFER_OPERATION:
|
||||
Log::warn("GLWrap", "glGetError: GL_INVALID_FRAMEBUFFER_OPERATION");
|
||||
break;
|
||||
case GL_OUT_OF_MEMORY:
|
||||
Log::warn("GLWrap", "glGetError: GL_OUT_OF_MEMORY");
|
||||
break;
|
||||
#if !defined(USE_GLES2)
|
||||
case GL_STACK_UNDERFLOW:
|
||||
Log::warn("GLWrap", "glGetError: GL_STACK_UNDERFLOW");
|
||||
break;
|
||||
case GL_STACK_OVERFLOW:
|
||||
Log::warn("GLWrap", "glGetError: GL_STACK_OVERFLOW");
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
Log::warn("GLWrap", "glGetError: %i", (int)err);
|
||||
break;
|
||||
}
|
||||
|
||||
return err != GL_NO_ERROR;
|
||||
}
|
||||
|
||||
#endif // !SERVER_ONLY
|
||||
|
||||
|
@ -168,6 +168,7 @@ void draw3DLine(const core::vector3df& start,
|
||||
bool hasGLExtension(const char* extension);
|
||||
const std::string getGLExtensions();
|
||||
void getGLLimits(HardwareStats::Json *json);
|
||||
bool checkGLError();
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user