From ae2f5c66d16fab9f92f960435057d955e9a832ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 1 Sep 2009 14:09:29 +0200 Subject: Fixed QGLFramebufferObject::toImage() releasing the FBO if bound. Reviewed-by: Trond --- src/opengl/qglframebufferobject.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 9659654..859afc7 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -875,9 +875,12 @@ QImage QGLFramebufferObject::toImage() const if (!d->valid) return QImage(); - const_cast(this)->bind(); + bool wasBound = isBound(); + if (!wasBound) + const_cast(this)->bind(); QImage image = qt_gl_read_framebuffer(d->size, d->ctx->format().alpha(), true); - const_cast(this)->release(); + if (!wasBound) + const_cast(this)->release(); return image; } -- cgit v0.12