summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglpaintdevice.cpp
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-12-04 07:17:00 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-12-04 07:17:00 (GMT)
commitc0b81480b2909b18ac15bdd124a562ae005c2f41 (patch)
tree8cb3feb9ed332d5211e78c6bc829c3577d098f8f /src/opengl/qglpaintdevice.cpp
parent108ab335537d20bc74aa9115d46cf91243223c4e (diff)
downloadQt-c0b81480b2909b18ac15bdd124a562ae005c2f41.zip
Qt-c0b81480b2909b18ac15bdd124a562ae005c2f41.tar.gz
Qt-c0b81480b2909b18ac15bdd124a562ae005c2f41.tar.bz2
Rebind window surface fbo after native GL rendering
If the user called QGLFramebufferObject::bind()/release() during a beginNativePainting() callout, the release() would reset the context's fbo to zero, not the actual window surface fbo. Task-number: QTBUG-6204 Reviewed-by: Tom
Diffstat (limited to 'src/opengl/qglpaintdevice.cpp')
-rw-r--r--src/opengl/qglpaintdevice.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp
index 2867de5..bcd90a5 100644
--- a/src/opengl/qglpaintdevice.cpp
+++ b/src/opengl/qglpaintdevice.cpp
@@ -89,6 +89,12 @@ void QGLPaintDevice::beginPaint()
ctx->d_ptr->current_fbo = m_thisFBO;
glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO);
}
+
+ // Set the default fbo for the context to m_thisFBO so that
+ // if some raw GL code between beginNativePainting() and
+ // endNativePainting() calls QGLFramebufferObject::release(),
+ // painting will revert to the window surface's fbo.
+ ctx->d_ptr->default_fbo = m_thisFBO;
}
void QGLPaintDevice::ensureActiveTarget()
@@ -101,6 +107,8 @@ void QGLPaintDevice::ensureActiveTarget()
ctx->d_ptr->current_fbo = m_thisFBO;
glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO);
}
+
+ ctx->d_ptr->default_fbo = m_thisFBO;
}
void QGLPaintDevice::endPaint()
@@ -111,6 +119,8 @@ void QGLPaintDevice::endPaint()
ctx->d_ptr->current_fbo = m_previousFBO;
glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_previousFBO);
}
+
+ ctx->d_ptr->default_fbo = 0;
}
QGLFormat QGLPaintDevice::format() const