From efa39697bf782ac65aabc1e5de87fd57bf7b5c21 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 13 Oct 2011 01:30:01 -0400 Subject: [PATCH] Implement GL_GetProcAddress() for Android. Fixes Bugzilla #1290. Thanks to Gabriel Jacobo for the patch! --- src/video/android/SDL_androidgl.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/video/android/SDL_androidgl.c b/src/video/android/SDL_androidgl.c index af536e253..f8d47be85 100644 --- a/src/video/android/SDL_androidgl.c +++ b/src/video/android/SDL_androidgl.c @@ -29,26 +29,43 @@ #include +#include + +static void* Android_GLHandle = NULL; /* GL functions */ int Android_GL_LoadLibrary(_THIS, const char *path) { - __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_LoadLibrary\n"); + if (!Android_GLHandle) { + Android_GLHandle = dlopen("libGLESv1_CM.so",RTLD_GLOBAL); + if (!Android_GLHandle) { + SDL_SetError("Could not initialize GL ES library\n"); + return -1; + } + } return 0; } void * Android_GL_GetProcAddress(_THIS, const char *proc) { - __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_GetProcAddress\n"); - return 0; + /* + !!! FIXME: this _should_ use eglGetProcAddress(), but it appears to be + !!! FIXME: busted on Android at the moment... + !!! FIXME: http://code.google.com/p/android/issues/detail?id=7681 + !!! FIXME: ...so revisit this later. --ryan. + */ + return dlsym(Android_GLHandle, proc); } void Android_GL_UnloadLibrary(_THIS) { - __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_UnloadLibrary\n"); + if(Android_GLHandle) { + dlclose(Android_GLHandle); + Android_GLHandle = NULL; + } } SDL_GLContext