aboutsummaryrefslogtreecommitdiff
path: root/sdl/pacc-gl-inc.h
diff options
context:
space:
mode:
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