DEADSOFTWARE

Add some checks
[nanogl.git] / nanogl.cpp
index c16a7a0f1f103acee3b39442752cfce2636f3999..11bd1eac4faf162e8d1bd5e9063deaee398499f1 100644 (file)
@@ -66,10 +66,28 @@ GlESInterface* glEsImpl = NULL;
 
 extern void InitGLStructs();
 
-static void gl_unimplemented() { 
+void gl_unimplemented() {
        LOGE ("Called unimplemented OpenGL ES API\n"); 
 }
 
+void *nanoGL_GetProcAddress(const char *name)
+{
+#if defined(__MULTITEXTURE_SUPPORT__)
+       if (!strcmp(procname, "glMultiTexCoord2fARB"))
+       {
+               return (void*)&glMultiTexCoord2fARB;
+       }
+       else if (!strcmp(procname, "glActiveTextureARB"))
+       {
+               return (void*)&glActiveTexture;
+       }
+       else if (!strcmp(procname, "glClientActiveTextureARB"))
+       {
+               return (void*)&glClientActiveTexture;
+       }
+#endif
+       return dlsym(glesLib, name);
+}
 
 static int CreateGlEsInterface( const char * name, void * lib, void * lib1, void * default_func )
 {
@@ -92,7 +110,7 @@ static int CreateGlEsInterface( const char * name, void * lib, void * lib1, void
        {
                void * f;
                
-               f = dlsym(lib, *api); // ltry ibGLESxx_CM.so
+               f = dlsym(lib, *api); // try libGLESxx_CM.so
 
                if (f == NULL) {
                        LOGW( "<%s> not found in %s. Trying libEGL.so.", *api, name); //driver);
@@ -109,8 +127,11 @@ static int CreateGlEsInterface( const char * name, void * lib, void * lib1, void
                                        LOGD ("<%s> @ 0x%p\n", *api, f);
                                }
                        }
-                       else 
+                       else
+                       {
+                               LOGE ( "libEGL.so not loaded!");
                                f = default_func;
+                       }
                }
                else {
                        LOGD ("<%s> @ 0x%p\n", *api, f);