From: mittorn Date: Thu, 12 May 2016 22:42:46 +0000 (+0000) Subject: Add some checks X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=4f937221b421f3c63856af69e4d620a7f8b0a6b0;p=nanogl.git Add some checks --- diff --git a/GL/glesinterface.h b/GL/glesinterface.h index 46de9e4..e8d42da 100644 --- a/GL/glesinterface.h +++ b/GL/glesinterface.h @@ -36,7 +36,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct GlESInterface { - int (*eglChooseConfig) (int dpy, const int *attrib_list, int *configs, int config_size, int *num_config) S; int (*eglCopyBuffers) (int dpy, int surface, void* target) S; int (*eglCreateContext) (int dpy, int config, int share_list, const int *attrib_list) S; diff --git a/eglwrap.cpp b/eglwrap.cpp index ab57519..0e6bd20 100644 --- a/eglwrap.cpp +++ b/eglwrap.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern "C++" GlESInterface* glEsImpl; extern "C++" void FlushOnStateChange(); - +void gl_unimplemented(); EGLint eglGetError (void) { @@ -159,10 +159,14 @@ EGLContext eglGetCurrentContext (void) } EGLSurface eglGetCurrentSurface (EGLint readdraw) { + if( (void*)glEsImpl->eglGetCurrentSurface == (void*)gl_unimplemented ) + return EGL_NO_SURFACE; return glEsImpl->eglGetCurrentSurface(readdraw); } EGLDisplay eglGetCurrentDisplay (void) { + if( (void*)glEsImpl->eglGetCurrentDisplay == (void*)gl_unimplemented ) + return EGL_NO_DISPLAY; return glEsImpl->eglGetCurrentDisplay(); } diff --git a/nanogl.cpp b/nanogl.cpp index 9130cec..11bd1ea 100644 --- a/nanogl.cpp +++ b/nanogl.cpp @@ -66,7 +66,7 @@ GlESInterface* glEsImpl = NULL; extern void InitGLStructs(); -static void gl_unimplemented() { +void gl_unimplemented() { LOGE ("Called unimplemented OpenGL ES API\n"); } @@ -127,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);