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>
This commit is contained in:
parent
9aa24645eb
commit
1d8ec5fae2
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user