Commits

Murat Sari committed abe0b9b

GLES: Log gles/egl errors via Ogre::LogManager

Comments (0)

Files changed (5)

RenderSystems/GLES/include/OgreGLESPrerequisites.h

     }
 
 #define ENABLE_GL_CHECK 0
+
 #if ENABLE_GL_CHECK
 #define GL_CHECK_ERROR \
     { \
         int e = glGetError(); \
         if (e != 0) \
         { \
-            fprintf(stderr, "OpenGL error 0x%04X in %s at line %i in %s\n", e, __PRETTY_FUNCTION__, __LINE__, __FILE__); \
+            const char * errorString = ""; \
+            switch(e) \
+            { \
+            case GL_INVALID_ENUM:       errorString = "GL_INVALID_ENUM";        break; \
+            case GL_INVALID_VALUE:      errorString = "GL_INVALID_VALUE";       break; \
+            case GL_INVALID_OPERATION:  errorString = "GL_INVALID_OPERATION";   break; \
+            case GL_OUT_OF_MEMORY:      errorString = "GL_OUT_OF_MEMORY";       break; \
+            default:                                                            break; \
+            } \
+            char msgBuf[1024]; \
+            sprintf(msgBuf, "OpenGL ES error 0x%04X %s in %s at line %i in %s \n", e, errorString, __PRETTY_FUNCTION__, __LINE__, __FILE__); \
+            LogManager::getSingleton().logMessage(msgBuf); \
         } \
     }
 #else
         int e = eglGetError(); \
         if ((e != 0) && (e != EGL_SUCCESS))\
         { \
-            fprintf(stderr, "OpenGL error 0x%04X in %s at line %i in %s\n", e, __PRETTY_FUNCTION__, __LINE__, __FILE__); \
-            assert(false); \
+            char msgBuf[1024]; \
+            sprintf(msgBuf, "EGL error 0x%04X in %s at line %i in %s \n", e, __PRETTY_FUNCTION__, __LINE__, __FILE__);\
+            LogManager::getSingleton().logMessage(msgBuf);\
         } \
     }
 #else

RenderSystems/GLES/src/EGL/Android/OgreAndroidEGLWindow.cpp

         if(mActive)
         {
             eglQuerySurface(mEglDisplay, mEglSurface, EGL_WIDTH, (EGLint*)&mWidth);
+			EGL_CHECK_ERROR
+			
             eglQuerySurface(mEglDisplay, mEglSurface, EGL_HEIGHT, (EGLint*)&mHeight);
             EGL_CHECK_ERROR
             

RenderSystems/GLES/src/EGL/OgreEGLWindow.cpp

         glFlush();
         if (eglSwapBuffers(mEglDisplay, mEglSurface) == EGL_FALSE)
         {
+			EGL_CHECK_ERROR
             OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR,
                         "Fail to SwapBuffers",
                         __FUNCTION__);
     ::EGLSurface EGLWindow::createSurfaceFromWindow(::EGLDisplay display,
                                                     NativeWindowType win)
     {
-        ::EGLSurface surface;
-
-        surface = eglCreateWindowSurface(display, mEglConfig, win, NULL);
+        ::EGLSurface surface = eglCreateWindowSurface(display, mEglConfig, win, NULL);
 
         if (surface == EGL_NO_SURFACE)
         {

RenderSystems/GLES/src/OgreGLESFBOMultiRenderTarget.cpp

 */
 
 #include "OgreGLESFBOMultiRenderTarget.h"
+#include "OgreLogManager.h"
 
 namespace Ogre {
 

RenderSystems/GLES/src/OgreGLESHardwareIndexBuffer.cpp

 #include "OgreGLESHardwareIndexBuffer.h"
 #include "OgreGLESHardwareBufferManager.h"
 #include "OgreException.h"
+#include "OgreLogManager.h"
 
 namespace Ogre {
     GLESHardwareIndexBuffer::GLESHardwareIndexBuffer(HardwareBufferManagerBase* mgr,