18 #ifndef DS3D_GLPROCESS_GL_COMMON_H
19 #define DS3D_GLPROCESS_GL_COMMON_H
21 #include "ds3d/common/common.h"
22 #include "ds3d/common/hpp/obj.hpp"
24 #include <GLES3/gl3.h>
30 #define GLFW_INCLUDE_NONE
31 #include <GLFW/glfw3.h>
33 #undef DS3D_RETURN_GLFW_ERROR
34 #define DS3D_RETURN_GLFW_ERROR(fmt, ...) \
36 const char* __description = nullptr; \
37 int __glfw_code = glfwGetError(&__description); \
41 __glfw_code == GLFW_NO_ERROR, ErrCode::kGL, "GLFW error: %s, " fmt, __description, \
46 #undef DS3D_GL_FAILED_RETURN
47 #define DS3D_GL_FAILED_RETURN(ret, fmt, ...) \
49 GLenum __gl_err = glGetError(); \
51 __gl_err == GL_NO_ERROR, ret, "GL error: %s, " fmt, \
52 ::ds3d::gl::GLErrorString(__gl_err), ##__VA_ARGS__); \
55 #undef DS3D_RETURN_GL_ERROR
56 #define DS3D_RETURN_GL_ERROR(fmt, ...) DS3D_GL_FAILED_RETURN(ErrCode::kGL, fmt, ##__VA_ARGS__)
58 namespace ds3d {
namespace gl {
60 using mat4f = std::vector<vec4f>;
66 #define _GL_ERROR_CASE_STR(value) \
75 #undef _GL_ERROR_CASE_STR
77 return "Unknown GL error";
83 #endif // DS3D_GLPROCESS_GL_COMMON_H