summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopengltextureglyphcache.cpp
diff options
context:
space:
mode:
authorValery Volgutov <valery.volgutov@lge.com>2013-05-21 14:18:17 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-05 12:56:00 +0200
commit1d8ec5fae2fa4bf694b93bb6bf14a7c42c84a9b6 (patch)
tree7ededefde1083634fb943eb87cdccf23e058fd59 /src/gui/opengl/qopengltextureglyphcache.cpp
parent9aa24645eb09be9e1d05060b2d976327726cb747 (diff)
Fix FBO restoring in QOpenGLTextureGlyphCache
QOpenGLTextureGlyphCache::restoreTextureData restores FBO which was binded before restoreTextureData call. More specifically, it restores QOpenGLContextPrivate's current_fbo member. This works if FBO was binded by QOpenGLFramebufferObject but not if FBO was binded using glBindFramebufferObject and rendering done via QOpenGLPaintDevice. This patch fixes it by querying current FBO using GL_FRAMEBUFFER_BINDING query and restoring it. Change-Id: Ia97a21e62566dc39a5191b66d3ca0e3ad0845ce1 Reviewed-by: Valery Volgutov <valery.volgutov@lge.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/gui/opengl/qopengltextureglyphcache.cpp')
-rw-r--r--src/gui/opengl/qopengltextureglyphcache.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
index 83f407575e..7d49c03f5b 100644
--- a/src/gui/opengl/qopengltextureglyphcache.cpp
+++ b/src/gui/opengl/qopengltextureglyphcache.cpp
@@ -147,6 +147,9 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
return;
}
+ GLint oldFbo;
+ glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFbo);
+
int oldWidth = m_textureResource->m_width;
int oldHeight = m_textureResource->m_height;
@@ -265,7 +268,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
glDeleteTextures(1, &tmp_texture);
glDeleteTextures(1, &oldTexture);
- funcs.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->current_fbo);
+ funcs.glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)oldFbo);
if (pex != 0) {
glViewport(0, 0, pex->width, pex->height);