diff --git a/drape/glfunctions.cpp b/drape/glfunctions.cpp index d25dbd252a..2509b82767 100644 --- a/drape/glfunctions.cpp +++ b/drape/glfunctions.cpp @@ -17,6 +17,8 @@ namespace void (*glViewportFn)(GLint x, GLint y, GLsizei w, GLsizei h) = NULL; void (*glFlushFn)() = NULL; + void (*glBindFramebufferFn)(GLenum target, GLuint id) = NULL; + /// VAO void (*glGenVertexArraysFn)(GLsizei n, GLuint * ids) = NULL; void (*glBindVertexArrayFn)(GLuint id) = NULL; @@ -100,6 +102,8 @@ void GLFunctions::Init() glDeleteVertexArrayFn = &glDeleteVertexArraysOES; #endif + glBindFramebufferFn = &::glBindFramebuffer; + glClearColorFn = &::glClearColor; glClearFn = &::glClear; glViewportFn = &::glViewport; @@ -170,24 +174,34 @@ bool GLFunctions::glHasExtension(const string & name) void GLFunctions::glClearColor(float r, float g, float b, float a) { + ASSERT(glClearColorFn != NULL, ()); GLCHECK(glClearColorFn(r, g, b, a)); } void GLFunctions::glClear() { + ASSERT(glClearFn != NULL, ()); GLCHECK(glClearFn(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)); } void GLFunctions::glViewport(uint32_t x, uint32_t y, uint32_t w, uint32_t h) { + ASSERT(glViewportFn != NULL, ()); GLCHECK(glViewportFn(x, y, w, h)); } void GLFunctions::glFlush() { + ASSERT(glFlushFn != NULL, ()); GLCHECK(glFlushFn()); } +void GLFunctions::glBindFramebuffer(glConst target, uint32_t id) +{ + ASSERT(glBindFramebufferFn != NULL, ()); + GLCHECK(glBindFramebufferFn(target, id)); +} + uint32_t GLFunctions::glGenVertexArray() { ASSERT(glGenVertexArraysFn != NULL, ()); diff --git a/drape/glfunctions.hpp b/drape/glfunctions.hpp index fd05ca0a12..05f599e269 100644 --- a/drape/glfunctions.hpp +++ b/drape/glfunctions.hpp @@ -14,6 +14,8 @@ public: static void glViewport(uint32_t x, uint32_t y, uint32_t w, uint32_t h); static void glFlush(); + static void glBindFramebuffer(glConst target, uint32_t id); + /// VAO support static uint32_t glGenVertexArray(); static void glBindVertexArray(uint32_t vao); diff --git a/drape_head/qtoglcontext.cpp b/drape_head/qtoglcontext.cpp index 076416129e..5430bc7f0b 100644 --- a/drape_head/qtoglcontext.cpp +++ b/drape_head/qtoglcontext.cpp @@ -3,6 +3,8 @@ #include "../base/assert.hpp" #include "../base/logging.hpp" +#include "../drape/glfunctions.hpp" + QtOGLContext::QtOGLContext(QWindow * surface, QtOGLContext * contextToShareWith) { m_isContextCreated = false; @@ -44,5 +46,5 @@ void QtOGLContext::present() void QtOGLContext::setDefaultFramebuffer() { - glBindFramebuffer(GL_FRAMEBUFFER, 0); + GLFunctions::glBindFramebuffer(GL_FRAMEBUFFER, 0); }