linux compilation fix

This commit is contained in:
exmix 2014-01-15 11:17:55 +04:00 committed by Alex Zolotarev
parent 9389978042
commit 7d05e80c81
3 changed files with 19 additions and 1 deletions

View file

@ -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, ());

View file

@ -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);

View file

@ -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);
}