1 // EGL does not work reliably for feature detection.
2 // Instead, we initialize gl4es manually.
3 #ifdef OPENMW_GL4ES_MANUAL_INIT
4 #include "gl4es_init.h"
5 
6 // For glHint
7 #include <GL/gl.h>
8 
9 extern "C" {
10 
11 #include <gl4es/gl4esinit.h>
12 #include <gl4es/gl4eshint.h>
13 
14 static SDL_Window *gWindow;
15 
openmw_gl4es_GetMainFBSize(int * width,int * height)16 void openmw_gl4es_GetMainFBSize(int *width, int *height)
17 {
18     SDL_GetWindowSize(gWindow, width, height);
19 }
20 
openmw_gl4es_init(SDL_Window * window)21 void openmw_gl4es_init(SDL_Window *window)
22 {
23     gWindow = window;
24     set_getprocaddress(SDL_GL_GetProcAddress);
25     set_getmainfbsize(openmw_gl4es_GetMainFBSize);
26     initialize_gl4es();
27 
28     // merge glBegin/glEnd in beams and console
29     glHint(GL_BEGINEND_HINT_GL4ES, 1);
30     // dxt unpacked to 16-bit looks ugly
31     glHint(GL_AVOID16BITS_HINT_GL4ES, 1);
32 }
33 
34 }  // extern "C"
35 
36 #endif  // OPENMW_GL4ES_MANUAL_INIT
37