From 51ced5a191078ce4ef08d57e343e91db007f556f Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 27 Oct 2021 19:30:06 +0800 Subject: *misc --- Runtime/Graphics/OpenGL.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'Runtime/Graphics/OpenGL.h') 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 -- cgit v1.1-26-g67d0