From 14dbfbe39d523019dc424337c9c18a189230cc95 Mon Sep 17 00:00:00 2001 From: a1batross Date: Mon, 24 Aug 2015 00:52:58 +0600 Subject: [PATCH] Fix typo in nanoGL_GetProcAddress, return 1 in nanoGL_Init() if wrapper already initialized --- nanogl.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nanogl.cpp b/nanogl.cpp index 9130cec..64c5f4d 100644 --- a/nanogl.cpp +++ b/nanogl.cpp @@ -64,13 +64,15 @@ static void* glesLib = NULL; GlESInterface* glEsImpl = NULL; +int initialized = 0; + extern void InitGLStructs(); static void gl_unimplemented() { LOGE ("Called unimplemented OpenGL ES API\n"); } -void *nanoGL_GetProcAddress(const char *name) +void *nanoGL_GetProcAddress(const char *procname) { #if defined(__MULTITEXTURE_SUPPORT__) if (!strcmp(procname, "glMultiTexCoord2fARB")) @@ -86,7 +88,7 @@ void *nanoGL_GetProcAddress(const char *name) return (void*)&glClientActiveTexture; } #endif - return dlsym(glesLib, name); + return dlsym(glesLib, procname); } static int CreateGlEsInterface( const char * name, void * lib, void * lib1, void * default_func ) @@ -153,6 +155,8 @@ static int loadDriver(const char * name) { */ int nanoGL_Init() { + if( initialized ) return 1; + const char * lib1 = "libGLESv1_CM.so"; // Has both gl* & egl* funcs SDK < 1.5 const char * lib2 = "libGLESv2.so"; // Only gl* funcs SDK >= 1.5 const char * lib3 = "libEGL.so"; // Only egl* funcs SDK >= 1.5 @@ -201,6 +205,7 @@ int nanoGL_Init() // Init nanoGL InitGLStructs(); + initialized = 1; return 1; } -- 2.29.2