summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond@trolltech.com>2009-11-05 10:21:31 (GMT)
committerTrond Kjernåsen <trond@trolltech.com>2009-11-05 10:23:28 (GMT)
commitec13cf30f10dabce37af3ce9d6763066e8cf4cc4 (patch)
tree11148f70bc1350b218bfdefd160123c35913612c /src
parenta12b1538df45268f2a66ec55856ffeeb131eb751 (diff)
downloadQt-ec13cf30f10dabce37af3ce9d6763066e8cf4cc4.zip
Qt-ec13cf30f10dabce37af3ce9d6763066e8cf4cc4.tar.gz
Qt-ec13cf30f10dabce37af3ce9d6763066e8cf4cc4.tar.bz2
Removed the FBO stacking behaviour and the test attached to it.
Having this behaviour in QGLFrameBufferObject complicates alot of things and isn't really necessary. Reviewed-by: Tom Cooksey
Diffstat (limited to 'src')
-rw-r--r--src/opengl/qglframebufferobject.cpp33
-rw-r--r--src/opengl/qglframebufferobject_p.h4
2 files changed, 9 insertions, 28 deletions
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 7374594..5295b6d 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -361,9 +361,6 @@ void QGLFBOGLPaintDevice::beginPaint()
if (QGLContext::currentContext() != context())
context()->makeCurrent();
- // We let QFBO track the previously bound FBO rather than doing it
- // ourselves here. This has the advantage that begin/release & bind/end
- // work as expected.
wasBound = fbo->isBound();
if (!wasBound)
fbo->bind();
@@ -896,17 +893,11 @@ bool QGLFramebufferObject::bind()
QGL_FUNC_CONTEXT;
if (!ctx)
return false; // Context no longer exists.
+ const QGLContext *current = QGLContext::currentContext();
glBindFramebuffer(GL_FRAMEBUFFER_EXT, d->fbo());
d->valid = d->checkFramebufferStatus();
- const QGLContext *context = QGLContext::currentContext();
- if (d->valid && context) {
- Q_ASSERT(QGLContextPrivate::contextGroup(context) == QGLContextPrivate::contextGroup(ctx));
- // Save the previous setting to automatically restore in release().
- if (context->d_ptr->current_fbo != d->fbo()) {
- d->previous_fbo = context->d_ptr->current_fbo;
- context->d_ptr->current_fbo = d->fbo();
- }
- }
+ if (d->valid && current)
+ current->d_ptr->current_fbo = d->fbo();
return d->valid;
}
@@ -917,30 +908,20 @@ bool QGLFramebufferObject::bind()
framebuffer.
Returns true upon success, false otherwise.
- Since 4.6: if another QGLFramebufferObject instance was already bound
- to the current context when bind() was called, then this function will
- automatically re-bind it to the current context.
-
\sa bind()
*/
bool QGLFramebufferObject::release()
{
if (!isValid())
return false;
- Q_D(QGLFramebufferObject);
QGL_FUNC_CONTEXT;
if (!ctx)
return false; // Context no longer exists.
- const QGLContext *context = QGLContext::currentContext();
- if (context) {
- Q_ASSERT(QGLContextPrivate::contextGroup(context) == QGLContextPrivate::contextGroup(ctx));
- // Restore the previous setting for stacked framebuffer objects.
- if (d->previous_fbo != context->d_ptr->current_fbo) {
- context->d_ptr->current_fbo = d->previous_fbo;
- glBindFramebuffer(GL_FRAMEBUFFER_EXT, d->previous_fbo);
- }
- d->previous_fbo = 0;
+ const QGLContext *current = QGLContext::currentContext();
+ if (current) {
+ current->d_ptr->current_fbo = 0;
+ glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
}
return true;
diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h
index 122c42e..c341459 100644
--- a/src/opengl/qglframebufferobject_p.h
+++ b/src/opengl/qglframebufferobject_p.h
@@ -127,7 +127,8 @@ private:
class QGLFramebufferObjectPrivate
{
public:
- QGLFramebufferObjectPrivate() : fbo_guard(0), texture(0), depth_stencil_buffer(0), color_buffer(0), valid(false), previous_fbo(0), engine(0) {}
+ QGLFramebufferObjectPrivate() : fbo_guard(0), texture(0), depth_stencil_buffer(0)
+ , color_buffer(0), valid(false), engine(0) {}
~QGLFramebufferObjectPrivate() {}
void init(QGLFramebufferObject *q, const QSize& sz,
@@ -143,7 +144,6 @@ public:
QGLFramebufferObjectFormat format;
uint valid : 1;
QGLFramebufferObject::Attachment fbo_attachment;
- GLuint previous_fbo;
mutable QPaintEngine *engine;
QGLFBOGLPaintDevice glDevice;