summaryrefslogtreecommitdiffstats
path: root/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
diff options
context:
space:
mode:
authorGiulio Camuffo <giulio.camuffo@jollamobile.com>2014-08-23 19:19:50 +0300
committerGiulio Camuffo <giulio.camuffo@jollamobile.com>2014-08-23 21:41:15 +0200
commit18ff0ff1ec5eb331fb25436386058b5d938a7ebb (patch)
treeb87e1d408ad7fe148b65c3faabd22f9c26c87986 /src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
parent4c5920fc041ee42e3aae6c954d48eb424c453de9 (diff)
Fix build with desktop OpenGL
Change-Id: I6a21f447f31e9eeeafed81275c33b0c2c79e1c8a Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp')
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
index fe51dab2..65fde250 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
@@ -141,6 +141,8 @@ class StateGuard
{
public:
StateGuard() {
+ QOpenGLFunctions glFuncs(QOpenGLContext::currentContext());
+
glGetIntegerv(GL_CURRENT_PROGRAM, (GLint *) &m_program);
glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint *) &m_activeTextureUnit);
glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint *) &m_texture);
@@ -153,13 +155,13 @@ public:
m_cull = glIsEnabled(GL_CULL_FACE);
m_scissor = glIsEnabled(GL_SCISSOR_TEST);
for (int i = 0; i < STATE_GUARD_VERTEX_ATTRIB_COUNT; ++i) {
- glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, (GLint *) &m_vertexAttribs[i].enabled);
- glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, (GLint *) &m_vertexAttribs[i].arrayBuffer);
- glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_SIZE, &m_vertexAttribs[i].size);
- glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &m_vertexAttribs[i].stride);
- glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_TYPE, (GLint *) &m_vertexAttribs[i].type);
- glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, (GLint *) &m_vertexAttribs[i].normalized);
- glGetVertexAttribPointerv(i, GL_VERTEX_ATTRIB_ARRAY_POINTER, &m_vertexAttribs[i].pointer);
+ glFuncs.glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, (GLint *) &m_vertexAttribs[i].enabled);
+ glFuncs.glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, (GLint *) &m_vertexAttribs[i].arrayBuffer);
+ glFuncs.glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_SIZE, &m_vertexAttribs[i].size);
+ glFuncs.glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &m_vertexAttribs[i].stride);
+ glFuncs.glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_TYPE, (GLint *) &m_vertexAttribs[i].type);
+ glFuncs.glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, (GLint *) &m_vertexAttribs[i].normalized);
+ glFuncs.glGetVertexAttribPointerv(i, GL_VERTEX_ATTRIB_ARRAY_POINTER, &m_vertexAttribs[i].pointer);
}
glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLint *) &m_minFilter);
glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLint *) &m_magFilter);
@@ -168,10 +170,12 @@ public:
}
~StateGuard() {
- glUseProgram(m_program);
+ QOpenGLFunctions glFuncs(QOpenGLContext::currentContext());
+
+ glFuncs.glUseProgram(m_program);
glActiveTexture(m_activeTextureUnit);
glBindTexture(GL_TEXTURE_2D, m_texture);
- glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
+ glFuncs.glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
glViewport(m_viewport[0], m_viewport[1], m_viewport[2], m_viewport[3]);
glDepthMask(m_depthWriteMask);
glColorMask(m_colorWriteMask[0], m_colorWriteMask[1], m_colorWriteMask[2], m_colorWriteMask[3]);
@@ -185,14 +189,14 @@ public:
glEnable(GL_SCISSOR_TEST);
for (int i = 0; i < STATE_GUARD_VERTEX_ATTRIB_COUNT; ++i) {
if (m_vertexAttribs[i].enabled)
- glEnableVertexAttribArray(i);
+ glFuncs.glEnableVertexAttribArray(i);
GLuint prevBuf;
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint *) &prevBuf);
- glBindBuffer(GL_ARRAY_BUFFER, m_vertexAttribs[i].arrayBuffer);
- glVertexAttribPointer(i, m_vertexAttribs[i].size, m_vertexAttribs[i].type,
- m_vertexAttribs[i].normalized, m_vertexAttribs[i].stride,
- m_vertexAttribs[i].pointer);
- glBindBuffer(GL_ARRAY_BUFFER, prevBuf);
+ glFuncs.glBindBuffer(GL_ARRAY_BUFFER, m_vertexAttribs[i].arrayBuffer);
+ glFuncs.glVertexAttribPointer(i, m_vertexAttribs[i].size, m_vertexAttribs[i].type,
+ m_vertexAttribs[i].normalized, m_vertexAttribs[i].stride,
+ m_vertexAttribs[i].pointer);
+ glFuncs.glBindBuffer(GL_ARRAY_BUFFER, prevBuf);
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, m_minFilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, m_magFilter);