void SMFL_GLCheckError(const std::string& expr, const std::string& file, unsigned int line)\r
{\r
// Get the last error\r
- GLenum ErrorCode = glGetError();\r
+ GLenum LastErrorCode = GL_NO_ERROR;\r
\r
- if (ErrorCode != GL_NO_ERROR)\r
+ for(GLenum ErrorCode = glGetError(); ErrorCode != GL_NO_ERROR; ErrorCode = glGetError())\r
+ {\r
+ CASPAR_LOG(error) << "OpenGL Error: " << ErrorCode << L" " << glewGetErrorString(ErrorCode);\r
+ LastErrorCode = ErrorCode;\r
+ }\r
+\r
+ if (LastErrorCode != GL_NO_ERROR)\r
{\r
// Decode the error code\r
- switch (ErrorCode)\r
+ switch (LastErrorCode)\r
{\r
case GL_INVALID_ENUM :\r
BOOST_THROW_EXCEPTION(ogl_invalid_enum()\r