-////////////////////////////////////////////////////////////\r
-//\r
-// SFML - Simple and Fast Multimedia Library\r
-// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)\r
-//\r
-// This software is provided 'as-is', without any express or implied warranty.\r
-// In no event will the authors be held liable for any damages arising from the use of this software.\r
-//\r
-// Permission is granted to anyone to use this software for any purpose,\r
-// including commercial applications, and to alter it and redistribute it freely,\r
-// subject to the following restrictions:\r
-//\r
-// 1. The origin of this software must not be misrepresented;\r
-// you must not claim that you wrote the original software.\r
-// If you use this software in a product, an acknowledgment\r
-// in the product documentation would be appreciated but is not required.\r
-//\r
-// 2. Altered source versions must be plainly marked as such,\r
-// and must not be misrepresented as being the original software.\r
-//\r
-// 3. This notice may not be removed or altered from any source distribution.\r
-//\r
-////////////////////////////////////////////////////////////\r
-\r
-#pragma once\r
-\r
-#include "../stdafx.h"\r
-\r
-#include "gl_check.h"\r
-\r
-#include "../log.h"\r
-\r
-#include <GL/glew.h>\r
-\r
-namespace caspar { namespace gl { \r
-\r
-void SMFL_GLCheckError(const std::string& expr, const std::string& file, unsigned int line)\r
-{\r
- // Get the last error\r
- GLenum LastErrorCode = GL_NO_ERROR;\r
-\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 (LastErrorCode)\r
- {\r
- case GL_INVALID_ENUM :\r
- BOOST_THROW_EXCEPTION(ogl_invalid_enum()\r
- << msg_info("an unacceptable value has been specified for an enumerated argument")\r
- << error_info("GL_INVALID_ENUM")\r
- << line_info(line)\r
- << source_info(file));\r
-\r
- case GL_INVALID_VALUE :\r
- BOOST_THROW_EXCEPTION(ogl_invalid_value()\r
- << msg_info("a numeric argument is out of range")\r
- << error_info("GL_INVALID_VALUE")\r
- << line_info(line)\r
- << source_info(file));\r
-\r
- case GL_INVALID_OPERATION :\r
- BOOST_THROW_EXCEPTION(ogl_invalid_operation()\r
- << msg_info("the specified operation is not allowed in the current state")\r
- << error_info("GL_INVALID_OPERATION")\r
- << line_info(line)\r
- << source_info(file));\r
-\r
- case GL_STACK_OVERFLOW :\r
- BOOST_THROW_EXCEPTION(ogl_stack_overflow()\r
- << msg_info("this command would cause a stack overflow")\r
- << error_info("GL_STACK_OVERFLOW")\r
- << line_info(line)\r
- << source_info(file));\r
-\r
- case GL_STACK_UNDERFLOW :\r
- BOOST_THROW_EXCEPTION(ogl_stack_underflow()\r
- << msg_info("this command would cause a stack underflow")\r
- << error_info("GL_STACK_UNDERFLOW")\r
- << line_info(line)\r
- << source_info(file));\r
-\r
- case GL_OUT_OF_MEMORY :\r
- BOOST_THROW_EXCEPTION(ogl_out_of_memory()\r
- << msg_info("there is not enough memory left to execute the command")\r
- << error_info("GL_OUT_OF_MEMORY")\r
- << line_info(line)\r
- << source_info(file));\r
-\r
- case GL_INVALID_FRAMEBUFFER_OPERATION_EXT :\r
- BOOST_THROW_EXCEPTION(ogl_stack_underflow()\r
- << msg_info("the object bound to FRAMEBUFFER_BINDING_EXT is not \"framebuffer complete\"")\r
- << error_info("GL_INVALID_FRAMEBUFFER_OPERATION_EXT")\r
- << line_info(line)\r
- << source_info(file));\r
- }\r
- }\r
-}\r
-\r
-}}
\ No newline at end of file
+///////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+///////////////////////////
+
+#include "../stdafx.h"
+
+#include "gl_check.h"
+
+#include "../log.h"
+
+#include <GL/glew.h>
+
+namespace caspar { namespace gl {
+
+void SMFL_GLCheckError(const std::string&, const std::string& file, unsigned int line)
+{
+ // Get the last error
+ GLenum LastErrorCode = GL_NO_ERROR;
+
+ for(GLenum ErrorCode = glGetError(); ErrorCode != GL_NO_ERROR; ErrorCode = glGetError())
+ {
+ CASPAR_LOG(error) << "OpenGL Error: " << ErrorCode << L" " << glewGetErrorString(ErrorCode);
+ LastErrorCode = ErrorCode;
+ }
+
+ if (LastErrorCode != GL_NO_ERROR)
+ {
+ // Decode the error code
+ switch (LastErrorCode)
+ {
+ case GL_INVALID_ENUM :
+ CASPAR_THROW_EXCEPTION(ogl_invalid_enum()
+ << msg_info("an unacceptable value has been specified for an enumerated argument")
+ << error_info("GL_INVALID_ENUM")
+ << line_info(line)
+ << source_info(file));
+
+ case GL_INVALID_VALUE :
+ CASPAR_THROW_EXCEPTION(ogl_invalid_value()
+ << msg_info("a numeric argument is out of range")
+ << error_info("GL_INVALID_VALUE")
+ << line_info(line)
+ << source_info(file));
+
+ case GL_INVALID_OPERATION :
+ CASPAR_THROW_EXCEPTION(ogl_invalid_operation()
+ << msg_info("the specified operation is not allowed in the current state")
+ << error_info("GL_INVALID_OPERATION")
+ << line_info(line)
+ << source_info(file));
+
+ case GL_STACK_OVERFLOW :
+ CASPAR_THROW_EXCEPTION(ogl_stack_overflow()
+ << msg_info("this command would cause a stack overflow")
+ << error_info("GL_STACK_OVERFLOW")
+ << line_info(line)
+ << source_info(file));
+
+ case GL_STACK_UNDERFLOW :
+ CASPAR_THROW_EXCEPTION(ogl_stack_underflow()
+ << msg_info("this command would cause a stack underflow")
+ << error_info("GL_STACK_UNDERFLOW")
+ << line_info(line)
+ << source_info(file));
+
+ case GL_OUT_OF_MEMORY :
+ CASPAR_THROW_EXCEPTION(ogl_out_of_memory()
+ << msg_info("there is not enough memory left to execute the command")
+ << error_info("GL_OUT_OF_MEMORY")
+ << line_info(line)
+ << source_info(file));
+
+ case GL_INVALID_FRAMEBUFFER_OPERATION_EXT :
+ CASPAR_THROW_EXCEPTION(ogl_stack_underflow()
+ << msg_info("the object bound to FRAMEBUFFER_BINDING_EXT is not \"framebuffer complete\"")
+ << error_info("GL_INVALID_FRAMEBUFFER_OPERATION_EXT")
+ << line_info(line)
+ << source_info(file));
+ }
+ }
+}
+
+}}