From f6448116ccd54da6c0287e2bec18cdd24bddc981 Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Thu, 13 Aug 2015 19:44:52 -0300 Subject: [PATCH] Fixed OpenGL ES function loading on some Android devices. --- src/modules/graphics/opengl/OpenGL.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/modules/graphics/opengl/OpenGL.cpp b/src/modules/graphics/opengl/OpenGL.cpp index a6d7d2aa1..df1092a0c 100644 --- a/src/modules/graphics/opengl/OpenGL.cpp +++ b/src/modules/graphics/opengl/OpenGL.cpp @@ -40,6 +40,10 @@ #include #endif +#ifdef LOVE_ANDROID +#include +#endif + namespace love { namespace graphics @@ -47,6 +51,17 @@ namespace graphics namespace opengl { +static void *LOVEGetProcAddress(const char *name) +{ +#ifdef LOVE_ANDROID + void *proc = dlsym(RTLD_DEFAULT, name); + if (proc) + return proc; +#endif + + return SDL_GL_GetProcAddress(name); +} + OpenGL::OpenGL() : stats() , contextInitialized(false) @@ -67,7 +82,7 @@ bool OpenGL::initContext() if (contextInitialized) return true; - if (!gladLoadGLLoader(SDL_GL_GetProcAddress)) + if (!gladLoadGLLoader(LOVEGetProcAddress)) return false; initOpenGLFunctions();