mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 00:26:40 +00:00 
			
		
		
		
	gl4es feature detection does not work reliably with EGL.
If a context already exists, gl4es can instead reliably detect
the underlying GLES features from the context itself.
This requires gl4es to be configured with:
    -DNOEGL=ON -DNO_LOADER=ON -DNO_INIT_CONSTRUCTOR=ON
This also requires gl4es to have this fix: https://github.com/ptitSeb/gl4es/pull/271
		
	
			
		
			
				
	
	
		
			36 lines
		
	
	
	
		
			814 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
	
		
			814 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| // EGL does not work reliably for feature detection.
 | |
| // Instead, we initialize gl4es manually.
 | |
| #ifdef OPENMW_GL4ES_MANUAL_INIT
 | |
| #include "gl4es_init.h"
 | |
| 
 | |
| // For glHint
 | |
| #include <GL/gl.h>
 | |
| 
 | |
| extern "C" {
 | |
| 
 | |
| #include <gl4es/gl4esinit.h>
 | |
| #include <gl4es/gl4eshint.h>
 | |
| 
 | |
| static SDL_Window *gWindow;
 | |
| 
 | |
| void openmw_gl4es_GetMainFBSize(int *width, int *height)
 | |
| {
 | |
|     SDL_GetWindowSize(gWindow, width, height);
 | |
| }
 | |
| 
 | |
| void openmw_gl4es_init(SDL_Window *window)
 | |
| {
 | |
|     gWindow = window;
 | |
|     set_getprocaddress(SDL_GL_GetProcAddress);
 | |
|     set_getmainfbsize(openmw_gl4es_GetMainFBSize);
 | |
|     initialize_gl4es();
 | |
| 
 | |
|     // merge glBegin/glEnd in beams and console
 | |
|     glHint(GL_BEGINEND_HINT_GL4ES, 1);
 | |
|     // dxt unpacked to 16-bit looks ugly
 | |
|     glHint(GL_AVOID16BITS_HINT_GL4ES, 1);
 | |
| }
 | |
| 
 | |
| }  // extern "C"
 | |
| 
 | |
| #endif  // OPENMW_GL4ES_MANUAL_INIT
 |