diff options
author | chai <chaifix@163.com> | 2021-10-27 19:30:06 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-27 19:30:06 +0800 |
commit | 51ced5a191078ce4ef08d57e343e91db007f556f (patch) | |
tree | 72dce341b2019e5b14c789a9edfb47d5b31900a6 /Runtime/Graphics/OpenGL.h | |
parent | e6a15decac22912900d2cbd2e5525229b92bb55a (diff) |
*misc
Diffstat (limited to 'Runtime/Graphics/OpenGL.h')
-rw-r--r-- | Runtime/Graphics/OpenGL.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/Runtime/Graphics/OpenGL.h b/Runtime/Graphics/OpenGL.h index 69755e1..b1b777e 100644 --- a/Runtime/Graphics/OpenGL.h +++ b/Runtime/Graphics/OpenGL.h @@ -8,17 +8,26 @@ //http://docs.gl/gl3/glClear #define CheckGLError(action)\ -if(true){ \ - GLenum error; \ +if(true){ \ + GLenum error; \ while ((error = glGetError()) != GL_NO_ERROR) { \ - action \ - } \ + action \ + } \ } -class GLException : std::exception +extern std::string g_sharedGLErrorMsg; + +class GLException : public std::exception { +public: + GLException(const char* what) + : std::exception(what) + {} + GLException(int glError) + { + g_sharedGLErrorMsg = std::to_string(glError); + std::exception(g_sharedGLErrorMsg.c_str()); + } }; -extern std::string g_sharedGLErrorMsg; - -#endif +#endif
\ No newline at end of file |