X-Git-Url: http://deadsoftware.ru/gitweb?p=nanogl.git;a=blobdiff_plain;f=nanogl.cpp;h=11bd1eac4faf162e8d1bd5e9063deaee398499f1;hp=823851fcae9117a6fcd0c8b94b2c605400565a10;hb=4f937221b421f3c63856af69e4d620a7f8b0a6b0;hpb=2a342cb7b58f8e29ec4852e195beed47d5f40821 diff --git a/nanogl.cpp b/nanogl.cpp index 823851f..11bd1ea 100644 --- a/nanogl.cpp +++ b/nanogl.cpp @@ -25,19 +25,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include //#include -#include #include "nanogl.h" #include "glesinterface.h" #include "gl.h" -#define LOG __android_log_print + #define DEBUG_NANO 0 +#ifdef __ANDROID__ +#include +#define LOG __android_log_print + #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) #define LOGD(...) if (DEBUG_NANO) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG,__VA_ARGS__) #define LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG,__VA_ARGS__) +#else + +#define LOGI(...) printf("I: "__VA_ARGS__) +#define LOGD(...) if(DEBUG_NANO) printf("D: "__VA_ARGS__) +#define LOGE(...) printf("E: "__VA_ARGS__) +#define LOGW(...) printf("W: "__VA_ARGS__) + +#endif + #define GL_ENTRY(_r, _api, ...) #_api, @@ -54,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 ) { @@ -80,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); @@ -97,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);