aboutsummaryrefslogtreecommitdiff
path: root/sdl/pacc-gl-inc.h
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-09-08 23:26:30 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-09-08 23:26:30 +0900
commit694da2ee4f6bf7dd8e5f592f9d9ecf0c5a7ceb24 (patch)
tree6dca19b69324008e67b4614efcee6fd568747689 /sdl/pacc-gl-inc.h
parent50c75c12597b230cec4d7a29559cde263025eeb2 (diff)
sdl: for testing pacc
Diffstat (limited to 'sdl/pacc-gl-inc.h')
-rw-r--r--sdl/pacc-gl-inc.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/sdl/pacc-gl-inc.h b/sdl/pacc-gl-inc.h
new file mode 100644
index 0000000..88e4aec
--- /dev/null
+++ b/sdl/pacc-gl-inc.h
@@ -0,0 +1,51 @@
+
+#ifdef PACC_GL_ES
+#ifdef PACC_GL_3
+#include <GLES3/gl3.h>
+#else
+#include <GLES2/gl2.h>
+#endif
+#else // PACC_GL_ES
+#ifdef PACC_GL_3
+#include <GL/glcorearb.h>
+#else
+#ifdef _WIN32
+#define PROC_NO_GL_1_1
+#include <GL/gl.h>
+#include <GL/glext.h>
+#else
+#define PROC_NO_GL_1_3
+#include <GL/gl.h>
+#endif
+#endif // PACC_GL_3
+#endif // PACC_GL_ES
+
+#ifdef PACC_GL_ES
+bool loadgl(void) {
+ return true;
+}
+#else // PACC_GL_ES
+#include <SDL.h>
+#define PROC(N, n) static PFNGL##N##PROC gl##n;
+#include "pacc/pacc-gl-procs.inc"
+#undef PROC
+#define PROC(N, n) \
+ gl##n = SDL_GL_GetProcAddress("gl" #n);\
+ if (!gl##n) {\
+ SDL_Log("Cannot load GL function \"gl" #n "\"\n");\
+ return false;\
+ }
+
+bool loadgl(void) {
+#include "pacc/pacc-gl-procs.inc"
+ return true;
+}
+#undef PROC
+#endif // PACC_GL_ES
+
+#ifdef PROC_NO_GL_1_1
+#undef PROC_NO_GL_1_1
+#endif
+#ifdef PROC_NO_GL_1_3
+#undef PROC_NO_GL_1_3
+#endif