summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-08-31 12:49:33 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-08-31 13:19:39 (GMT)
commitf776327408d828a2556e8f9a35df5fe3c2976ef6 (patch)
tree0e4934e04271b95832433d3c307928126224ed9d /src/opengl
parent2b950244a3615c2611a636afbf372411c9db491c (diff)
downloadQt-f776327408d828a2556e8f9a35df5fe3c2976ef6.zip
Qt-f776327408d828a2556e8f9a35df5fe3c2976ef6.tar.gz
Qt-f776327408d828a2556e8f9a35df5fe3c2976ef6.tar.bz2
Fixed having a QPainter active on several FBOs at the same time.
It's insufficient to use a single paint engine to render to all FBOs. If the default engine is already in used we need to create our own engine. Reviewed-by: Trond
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qglframebufferobject.cpp39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index fe967e7..9659654 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -262,7 +262,7 @@ GLenum QGLFramebufferObjectFormat::internalFormat() const
class QGLFramebufferObjectPrivate
{
public:
- QGLFramebufferObjectPrivate() : depth_stencil_buffer(0), valid(false), bound(false), ctx(0), previous_fbo(0) {}
+ QGLFramebufferObjectPrivate() : depth_stencil_buffer(0), valid(false), bound(false), ctx(0), previous_fbo(0), engine(0) {}
~QGLFramebufferObjectPrivate() {}
void init(const QSize& sz, QGLFramebufferObject::Attachment attachment,
@@ -280,6 +280,7 @@ public:
QGLFramebufferObject::Attachment fbo_attachment;
QGLContext *ctx; // for Windows extension ptrs
GLuint previous_fbo;
+ mutable QPaintEngine *engine;
};
bool QGLFramebufferObjectPrivate::checkFramebufferStatus() const
@@ -723,6 +724,8 @@ QGLFramebufferObject::~QGLFramebufferObject()
Q_D(QGLFramebufferObject);
QGL_FUNC_CONTEXT;
+ delete d->engine;
+
if (isValid()
&& (d->ctx == QGLContext::currentContext()
|| qgl_share_reg()->checkSharing(d->ctx, QGLContext::currentContext())))
@@ -890,16 +893,32 @@ Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_buffer_engine)
/*! \reimp */
QPaintEngine *QGLFramebufferObject::paintEngine() const
{
-#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL)
- return qt_buffer_engine();
-#elif defined(QT_OPENGL_ES_2)
- return qt_buffer_2_engine();
-#else
Q_D(const QGLFramebufferObject);
- if (qt_gl_preferGL2Engine())
- return qt_buffer_2_engine();
- else
- return qt_buffer_engine();
+ if (d->engine)
+ return d->engine;
+
+#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
+#if !defined (QT_OPENGL_ES_2)
+ if (qt_gl_preferGL2Engine()) {
+#endif
+ QPaintEngine *engine = qt_buffer_2_engine();
+ if (engine->isActive() && engine->paintDevice() != this) {
+ d->engine = new QGL2PaintEngineEx;
+ return d->engine;
+ }
+ return engine;
+#if !defined (QT_OPENGL_ES_2)
+ }
+#endif
+#endif
+
+#if !defined(QT_OPENGL_ES_2)
+ QPaintEngine *engine = qt_buffer_engine();
+ if (engine->isActive() && engine->paintDevice() != this) {
+ d->engine = new QOpenGLPaintEngine;
+ return d->engine;
+ }
+ return engine;
#endif
}