From e754a3542140ad87ff02346910c80c2ec2f810ef Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Sun, 8 Dec 2013 00:50:38 +0100 Subject: [PATCH] glad: Load GL functions first using dlsym then SDL_GL_GetProcAddress --- jni/love/src/libraries/glad/glad.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/jni/love/src/libraries/glad/glad.cpp b/jni/love/src/libraries/glad/glad.cpp index 4d023221..1dcb221b 100644 --- a/jni/love/src/libraries/glad/glad.cpp +++ b/jni/love/src/libraries/glad/glad.cpp @@ -1,5 +1,6 @@ #include #include "glad.hpp" +#include #define GLAD_USE_SDL @@ -10,13 +11,22 @@ namespace glad { #if !SDL_VERSION_ATLEAST(2,0,0) #error SDL 2 is required! #endif + +void* LoaderDlsymOrSDLGetProc (const char* name) { + void* proc = dlsym(RTLD_DEFAULT, name); + if (!proc) { + proc = SDL_GL_GetProcAddress (name); + } + return proc; +} + #else #include #endif bool gladLoadGL(void) { #ifdef GLAD_USE_SDL - return gladLoadGLLoader(SDL_GL_GetProcAddress); + return gladLoadGLLoader(LoaderDlsymOrSDLGetProc); #else // generic gladLoadGL is not implemented, use gladLoadGLLoader or define GLAD_USE_SDL assert(0);