X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=nanogl.cpp;h=64c5f4da9eb5f8b90faec6a93af1f35590197867;hb=14dbfbe39d523019dc424337c9c18a189230cc95;hp=c16a7a0f1f103acee3b39442752cfce2636f3999;hpb=b19af4588eb9e9fa5394512ebde4f0111c8e9d98;p=nanogl.git diff --git a/nanogl.cpp b/nanogl.cpp index c16a7a0..64c5f4d 100644 --- a/nanogl.cpp +++ b/nanogl.cpp @@ -64,12 +64,32 @@ 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 *procname) +{ +#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, procname); +} static int CreateGlEsInterface( const char * name, void * lib, void * lib1, void * default_func ) { @@ -92,7 +112,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); @@ -135,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 @@ -183,6 +205,7 @@ int nanoGL_Init() // Init nanoGL InitGLStructs(); + initialized = 1; return 1; }