diff --git a/yg/framebuffer.cpp b/yg/framebuffer.cpp index d6dc8f1368..65fced31af 100644 --- a/yg/framebuffer.cpp +++ b/yg/framebuffer.cpp @@ -129,29 +129,32 @@ namespace yg void FrameBuffer::checkStatus() { + if (!yg::gl::g_doFakeOpenGLCalls) + { #ifdef OMIM_GL_ES - GLenum res = glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES); - if (res == GL_FRAMEBUFFER_UNSUPPORTED_OES) - LOG(LINFO, ("unsupported combination of attached target formats. could be possibly skipped")); - else if (res == GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES) - LOG(LINFO, ("incomplete attachement")); - else if (res == GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES) - LOG(LINFO, ("incomplete missing attachement")); - else if (res == GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES) - { - LOG(LINFO, ("incomplete dimensions")); - } + GLenum res = glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES); + if (res == GL_FRAMEBUFFER_UNSUPPORTED_OES) + LOG(LINFO, ("unsupported combination of attached target formats. could be possibly skipped")); + else if (res == GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES) + LOG(LINFO, ("incomplete attachement")); + else if (res == GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES) + LOG(LINFO, ("incomplete missing attachement")); + else if (res == GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES) + { + LOG(LINFO, ("incomplete dimensions")); + } #else - GLenum res = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (res == GL_FRAMEBUFFER_UNSUPPORTED) - { - LOG(LINFO, ("unsupported combination of attached target formats. could be possibly skipped")); - } - else if (res != GL_FRAMEBUFFER_COMPLETE_EXT) - { - LOG(LERROR, ("incomplete framebuffer")); - } + GLenum res = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if (res == GL_FRAMEBUFFER_UNSUPPORTED) + { + LOG(LINFO, ("unsupported combination of attached target formats. could be possibly skipped")); + } + else if (res != GL_FRAMEBUFFER_COMPLETE_EXT) + { + LOG(LERROR, ("incomplete framebuffer")); + } #endif + } } } } diff --git a/yg/internal/opengl.cpp b/yg/internal/opengl.cpp index 72435072db..290e90de7c 100644 --- a/yg/internal/opengl.cpp +++ b/yg/internal/opengl.cpp @@ -12,6 +12,7 @@ namespace yg { namespace gl { + bool g_doFakeOpenGLCalls = false; bool g_isBufferObjectsSupported = true; bool g_isFramebufferSupported = true; bool g_isRenderbufferSupported = true; diff --git a/yg/internal/opengl.hpp b/yg/internal/opengl.hpp index 9938cc747f..41cfef6fec 100644 --- a/yg/internal/opengl.hpp +++ b/yg/internal/opengl.hpp @@ -39,6 +39,7 @@ namespace yg { namespace gl { + extern bool g_doFakeOpenGLCalls; //< for testing support extern bool g_isBufferObjectsSupported; extern bool g_isFramebufferSupported; extern bool g_isRenderbufferSupported; @@ -53,11 +54,11 @@ namespace yg } #ifdef DEBUG -#define OGLCHECK(f) do {f; yg::gl::CheckError(SRC());} while(false) -#define OGLCHECKAFTER yg::gl::CheckError(SRC()) +#define OGLCHECK(f) do {if (!g_doFakeOpenGLCalls) { f; yg::gl::CheckError(SRC()); } } while(false) +#define OGLCHECKAFTER if (!g_doFakeOpenGLCalls) yg::gl::CheckError(SRC()) #define EGLCHECK do {yg::gl::CheckEGLError(SRC());} while(false) #else -#define OGLCHECK(f) f +#define OGLCHECK(f) if (!g_doFakeOpenGLCalls) f #define OGLCHECKAFTER #define EGLCHECK #endif