#pragma once /* * Created by Brett on 16/12/23. * Licensed under GNU General Public License V3.0 * See LICENSE file for license detail */ #ifndef BLT_GL_INCLUDES_H #define BLT_GL_INCLUDES_H #include // emscripten provides its own gl bindings. #ifndef __EMSCRIPTEN__ #include #else #include #include #include #include #include #define GL_GLEXT_PROTOTYPES #define EGL_EGLEXT_PROTOTYPES #endif namespace blt::gfx { inline std::string get_error_message(GLenum error) { switch (error) { case GL_INVALID_ENUM: return "Invalid Enum"; case GL_INVALID_VALUE: return "Invalid Value"; case GL_INVALID_OPERATION: return "Invalid Operation"; case GL_STACK_OVERFLOW: return "Stack Overflow"; case GL_STACK_UNDERFLOW: return "Stack Underflow"; case GL_OUT_OF_MEMORY: return "Out Of Memory"; case GL_INVALID_FRAMEBUFFER_OPERATION: return "Invalid Framebuffer Operation"; case GL_INVALID_INDEX: return "Invalid Index"; } return std::string("Unknown Error: ") += std::to_string(error); } inline void handle_errors() { GLenum err; while ((err = glGetError()) != GL_NO_ERROR) { BLT_ERROR(get_error_message(err)); } } } #endif //BLT_GL_INCLUDES_H