diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-03-17 15:55:00 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-03-18 17:37:45 +0000 |
commit | c1a2f97a3b3a8c058b1760b57e5c83bf7815b84a (patch) | |
tree | 78a5100cb1302396c0f0f9e7bd00652232d0a666 /src/widgets | |
parent | 9ef14bcc3a71a95d9338d360b429cd8a4061ad3d (diff) |
Set default fbo redirect correctly for QOpenGLWidget viewports
Task-number: QTBUG-59318
Change-Id: Icf2ea4e5ebdeec31750edc8b34a9b9f6bfb64744
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qopenglwidget.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index 147e0774e7..23948892f0 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -537,6 +537,7 @@ public: w(widget) { } void beginPaint() Q_DECL_OVERRIDE; + void endPaint() Q_DECL_OVERRIDE; QOpenGLWidget *w; }; @@ -631,6 +632,16 @@ void QOpenGLWidgetPaintDevicePrivate::beginPaint() } } +void QOpenGLWidgetPaintDevicePrivate::endPaint() +{ + QOpenGLWidgetPrivate *wd = static_cast<QOpenGLWidgetPrivate *>(QWidgetPrivate::get(w)); + if (!wd->initialized) + return; + + if (!wd->inPaintGL) + QOpenGLContextPrivate::get(wd->context)->defaultFboRedirect = 0; +} + void QOpenGLWidgetPaintDevice::ensureActiveTarget() { QOpenGLWidgetPaintDevicePrivate *d = static_cast<QOpenGLWidgetPaintDevicePrivate *>(d_ptr.data()); @@ -643,6 +654,9 @@ void QOpenGLWidgetPaintDevice::ensureActiveTarget() else wd->fbo->bind(); + if (!wd->inPaintGL) + QOpenGLContextPrivate::get(wd->context)->defaultFboRedirect = wd->fbo->handle(); + // When used as a viewport, drawing is done via opening a QPainter on the widget // without going through paintEvent(). We will have to make sure a glFlush() is done // before the texture is accessed also in this case. |