aboutsummaryrefslogtreecommitdiff
path: root/sdl/pacc-gl-inc.h
blob: 88e4aec37820bce03edd17fe2592ac083444a129 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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