From e0e0ae322e654b0b152fc54d99201b18b620a0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 1 Sep 2009 14:16:08 +0200 Subject: Fixed toImage() not working on a multisample QGLFramebufferObject. Need to blit into a regular QGLFramebufferObject first to force a multisample resolve. Reviewed-by: Trond --- src/opengl/qglframebufferobject.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 859afc7..8fd113a 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -875,6 +875,16 @@ QImage QGLFramebufferObject::toImage() const if (!d->valid) return QImage(); + // qt_gl_read_framebuffer doesn't work on a multisample FBO + if (format().samples() != 0) { + QGLFramebufferObject temp(size()); + + QRect rect(QPoint(0, 0), size()); + blitFramebuffer(&temp, rect, const_cast(this), rect); + + return temp.toImage(); + } + bool wasBound = isBound(); if (!wasBound) const_cast(this)->bind(); -- cgit v0.12