diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-10-14 12:07:41 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-10-14 18:14:52 +0200 |
commit | ebc835c2aa02f0b3dc6e4806bde03f33513d3556 (patch) | |
tree | 6835e3de1312373c7082052d542e2782d7d3a0fa /src/gui/opengl/qopenglpaintdevice.cpp | |
parent | 4bf0660ae4e695ceb79f585b92dedf00d7757f31 (diff) |
Fix QOpenGLWidget on Cocoa when used as viewport
Having a QOpenGLWidget as a graphics view viewport was not functioning
on OS X: it was showing incomplete content due to accessing the texture
attached to the framebuffer object before the rendering is complete.
On the normal path, when rendering is done via paintGL(), the flush was
there. When used as a viewport however, this path is not used. The missing
flush is now added for the other case too. For performance reasons, we will
not flush on every paint engine end(). Instead, the flush is deferred until
composition starts.
QGLWidget also featured a weird on-by-default autoFillBackground concept. To
maintain compatibility with apps that used QGLWidget as the viewport for
QGraphicsView, we will now do the same for QOpenGLWidget, but only when it
is used as a viewport. For regular QOpenGLWidgets autoFillBackground defaults
to false, like for any other widget. The docs are extended with a small section
about differences between QGLWidget and QOpenGLWidget.
Task-number: QTBUG-41046
Change-Id: I42c2033fdd2ef5815783fd640fe11373761061e0
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/gui/opengl/qopenglpaintdevice.cpp')
-rw-r--r-- | src/gui/opengl/qopenglpaintdevice.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp index 59bca6efdf..c2f3295bc3 100644 --- a/src/gui/opengl/qopenglpaintdevice.cpp +++ b/src/gui/opengl/qopenglpaintdevice.cpp @@ -351,14 +351,39 @@ bool QOpenGLPaintDevice::paintFlipped() const } /*! + This virtual method is called when starting to paint. + + The default implementation does nothing. + + \sa endPaint() + */ +void QOpenGLPaintDevice::beginPaint() +{ +} + +/*! This virtual method is provided as a callback to allow re-binding a target frame buffer object or context when different QOpenGLPaintDevice instances are issuing draw calls alternately. - QPainter::beginNativePainting will also trigger this method. + \l{QPainter::beginNativePainting()}{beginNativePainting()} will also trigger + this method. + + The default implementation does nothing. */ void QOpenGLPaintDevice::ensureActiveTarget() { } +/*! + This virtual method is called when the painting has finished. + + The default implementation does nothing. + + \sa beginPaint() +*/ +void QOpenGLPaintDevice::endPaint() +{ +} + QT_END_NAMESPACE |