all repos — mgba @ 2506fd5330dbe920836ac442e1b0614a3efc8854

mGBA Game Boy Advance Emulator

GBA Video: Detect OpenGL ES
Vicki Pfau vi@endrift.com
Thu, 23 May 2019 13:11:53 -0700
commit

2506fd5330dbe920836ac442e1b0614a3efc8854

parent

bbf06b5f1312c7f5d8dcf3a4e6f8c9ddbf76e6d8

1 files changed, 10 insertions(+), 2 deletions(-)

jump to
M src/gba/renderers/gl.csrc/gba/renderers/gl.c

@@ -54,6 +54,9 @@ const char* name;

int type; }; +static const GLchar* const _gles3Header = + "#version 300\n"; + static const GLchar* const _gl3Header = "#version 130\n";

@@ -751,8 +754,13 @@ glBindFramebuffer(GL_FRAMEBUFFER, 0);

} char log[1024]; - const GLchar* shaderBuffer[8]; - shaderBuffer[0] = _gl3Header; + const GLchar* shaderBuffer[4]; + const GLubyte* version = glGetString(GL_VERSION); + if (strncmp((const char*) version, "OpenGL ES ", strlen("OpenGL ES "))) { + shaderBuffer[0] = _gl3Header; + } else { + shaderBuffer[0] = _gles3Header; + } GLuint vs = glCreateShader(GL_VERTEX_SHADER); shaderBuffer[1] = _vertexShader;