diff --git a/backends/graphics/opengl/debug.cpp b/backends/graphics/opengl/debug.cpp index 69006bb9752..d5d73fb5ecc 100644 --- a/backends/graphics/opengl/debug.cpp +++ b/backends/graphics/opengl/debug.cpp @@ -52,9 +52,9 @@ Common::String getGLErrStr(GLenum error) { } // End of anonymous namespace void checkGLError(const char *expr, const char *file, int line) { - GLenum error = glGetError(); + GLenum error; - if (error != GL_NO_ERROR) { + while ((error = glGetError()) != GL_NO_ERROR) { // We cannot use error here because we do not know whether we have a // working screen or not. warning("GL ERROR: %s on %s (%s:%d)", getGLErrStr(error).c_str(), expr, file, line);