diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-09-01 13:52:44 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-09-08 16:36:14 (GMT) |
commit | e8b5bfa8a86b2d7c79aabcc4566f740f0a9afe7c (patch) | |
tree | b11a5707ef080a8ef94fb3e7a2e79ce38d7576a4 /src/opengl/qglpaintdevice_p.h | |
parent | b7963df603a315136b32297b861f089c0cd49acd (diff) | |
download | Qt-e8b5bfa8a86b2d7c79aabcc4566f740f0a9afe7c.zip Qt-e8b5bfa8a86b2d7c79aabcc4566f740f0a9afe7c.tar.gz Qt-e8b5bfa8a86b2d7c79aabcc4566f740f0a9afe7c.tar.bz2 |
Make QGLFramebufferObject work again using new QGLPaintDevice API
This patch also refactors QGL2PaintEngineEx::ensureActive() and the
logic which handles multiple paint engines rendering to the same
QGLContext. In a nut-shell:
* QGLPaintDevice::beginPaint() stores the currently bound FBO
* QGLPaintDevice::ensureActiveTarget() makes sure that GL rendering will
end up in the paint device (I.e. the right context is current and the
right FBO is bound). If a different context or FBO was bound, it is
_not_ remembered.
* QGLPaintDevice::endPaint() restores whatever FBO was bound when
beginPaint() was called.
This logic allows interleaved painter rendering to multiple FBOs and
contexts to work as expected. It also allows a stacked begin/end to work
properly when it's mixed with native GL rendering (as far as current
render target is concerened. GL state clobbering is obviously a
different topic).
QGLPaintDevice::context() also had to be made virtual as there's no good
place to call setContext. This might be possible to change in the future
though.
Finally, to make this work, QGLFramebufferObjectPrivate had to be moved
into it's own private header.
Diffstat (limited to 'src/opengl/qglpaintdevice_p.h')
-rw-r--r-- | src/opengl/qglpaintdevice_p.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/opengl/qglpaintdevice_p.h b/src/opengl/qglpaintdevice_p.h index ad680a9..c5fa626 100644 --- a/src/opengl/qglpaintdevice_p.h +++ b/src/opengl/qglpaintdevice_p.h @@ -63,14 +63,14 @@ public: virtual ~QGLPaintDevice(); virtual void beginPaint(); + virtual void ensureActiveTarget(); virtual void endPaint(); virtual QColor backgroundColor() const; virtual bool autoFillBackground() const; virtual bool hasTransparentBackground() const; - // inline these? - QGLContext* context() const; + virtual QGLContext* context() const = 0; QGLFormat format() const; virtual QSize size() const; @@ -79,10 +79,11 @@ public: protected: // Inline? - void setContext(QGLContext* c); +// void setContext(QGLContext* c); private: - QGLContext* m_context; +// QGLContext* m_context; + GLuint m_previousFBO; }; @@ -102,6 +103,7 @@ public: // QGLWidgets need to do swapBufers in endPaint: virtual void endPaint(); virtual QSize size() const; + virtual QGLContext* context() const; void setWidget(QGLWidget*); |