From 8c45a1eaa641284f8533af67c706b3cb2c69c2e1 Mon Sep 17 00:00:00 2001 From: mittorn Date: Thu, 16 Feb 2017 18:35:38 +0600 Subject: [PATCH] Force SDL for early iOS port --- nanoWrap.cpp | 6 +++--- nanogl.cpp | 15 ++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/nanoWrap.cpp b/nanoWrap.cpp index b46b4c7..420ea78 100644 --- a/nanoWrap.cpp +++ b/nanoWrap.cpp @@ -166,7 +166,7 @@ static struct nanotmuState tmuInitState = static struct nanotmuState *activetmuState = &tmuState0; -extern "C++" GlESInterface *glEsImpl; +extern GlESInterface *glEsImpl; static GLenum wrapperPrimitiveMode = GL_QUADS; GLboolean useTexCoordArray = GL_FALSE; @@ -2099,7 +2099,7 @@ void glDrawArrays( GLenum mode, GLint first, GLsizei count ) { glEsImpl->glNormalPointer( type, stride, ptr ); }*/ - +/* void glCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) { FlushOnStateChange( ); @@ -2157,4 +2157,4 @@ void glRenderbufferStorage( GLenum target, GLenum internalformat, GLsizei width, { FlushOnStateChange( ); glEsImpl->glRenderbufferStorage( target, internalformat, width, height ); -} +}*/ diff --git a/nanogl.cpp b/nanogl.cpp index 9af6d1d..90cf802 100644 --- a/nanogl.cpp +++ b/nanogl.cpp @@ -86,6 +86,7 @@ static char const *const gl_names[] = { static void *glesLib = NULL; +extern "C++" GlESInterface *glEsImpl; GlESInterface *glEsImpl = NULL; extern void InitGLStructs( ); @@ -134,7 +135,7 @@ static int CreateGlEsInterface( const char *name, void *lib, void *lib1, void *d { void *f; - f = dlsym( lib, *api ); // try libGLESxx_CM.so + f = SDL_GL_GetProcAddress(*api);//dlsym( lib, *api ); // try libGLESxx_CM.so #ifdef USE_CORE_PROFILE // Hack: try ARB and EXT suffix @@ -151,7 +152,7 @@ static int CreateGlEsInterface( const char *name, void *lib, void *lib1, void *d f = dlsym( lib, namearb ); } #endif - if ( f == NULL ) + /*if ( f == NULL ) { LOGW( "<%s> not found in %s. Trying libEGL.so.", *api, name ); //driver); @@ -182,7 +183,7 @@ static int CreateGlEsInterface( const char *name, void *lib, void *lib1, void *d f = (void *)default_func; } } - else + else*/ { LOGD( "<%s> @ 0x%p\n", *api, f ); } @@ -266,13 +267,13 @@ int nanoGL_Init( ) 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 - const char *driver; + const char *driver = NULL; // load lib LOGI( "nanoGL: Init loading driver %s\n", lib1 ); //LOG (ANDROID_LOG_DEBUG, LOG_TAG, "nanoGL: Init loading driver %s\n", lib1); - if ( !loadDriver( lib1 ) ) + /*if ( !loadDriver( lib1 ) ) { LOGE( "Failed to load driver %s. Trying %s\n", lib1, lib2 ); @@ -285,7 +286,7 @@ int nanoGL_Init( ) driver = lib2; } else - driver = lib1; + driver = lib1;*/ void *eglLib; @@ -302,7 +303,7 @@ int nanoGL_Init( ) // Load API gl* for 1.5+ else egl* gl* //if (CreateGlEsInterface(driver, glesLib, eglLib, NULL) == -1) - if ( !CreateGlEsInterface( driver, glesLib, eglLib, (void *)gl_unimplemented ) == -1 ) + if ( !CreateGlEsInterface( driver, 0, 0, (void *)gl_unimplemented ) == -1 ) { // release lib LOGE( "CreateGlEsInterface failed." ); -- 2.29.2