diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2015-04-13 14:28:58 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@digia.com> | 2015-04-13 14:28:58 +0200 |
commit | 02ff2973ceeef00ced4468b6e15cfadd9f021b0d (patch) | |
tree | e5b51329fceb3d0134e533e41c0f3800549f1786 /src/widgets/kernel/qopenglwidget.cpp | |
parent | c5b743472fc36986cf34636dbcb73a0d0fa6b9e6 (diff) | |
parent | 16c32710bc8a5ecefc833352159361be564f3fe4 (diff) |
Merge remote-tracking branch 'gerrit/dev' into dev-highdpi
Conflicts:
src/plugins/platforms/xcb/qxcbbackingstore.cpp
Change-Id: Ib7f277957636186d0abd58d8c710392ef7b02e13
Diffstat (limited to 'src/widgets/kernel/qopenglwidget.cpp')
-rw-r--r-- | src/widgets/kernel/qopenglwidget.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index 8c60818819..9a0584bea9 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -46,6 +46,7 @@ #include <QtGui/private/qopenglextensions_p.h> #include <QtGui/private/qfont_p.h> #include <QtGui/private/qopenglpaintdevice_p.h> +#include <QtGui/private/qopenglcontext_p.h> #include <QtWidgets/private/qwidget_p.h> QT_BEGIN_NAMESPACE @@ -435,6 +436,23 @@ QT_BEGIN_NAMESPACE each frame. To restore the preserved behavior, call setUpdateBehavior() with \c PartialUpdate. + \section1 Alternatives + + Adding a QOpenGLWidget into a window turns on OpenGL-based + compositing for the entire window. In some special cases this may + not be ideal, and the old QGLWidget-style behavior with a separate, + native child window is desired. Desktop applications that understand + the limitations of this approach (for example when it comes to + overlaps, transparency, scroll views and MDI areas), can use + QOpenGLWindow with QWidget::createWindowContainer(). This is a + modern alternative to QGLWidget and is faster than QOpenGLWidget due + to the lack of the additional composition step. It is strongly + recommended to limit the usage of this approach to cases where there + is no other choice. Note that this option is not suitable for most + embedded and mobile platforms, and it is known to have issues on + certain desktop platforms (e.g. OS X) too. The stable, + cross-platform solution is always QOpenGLWidget. + \e{OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other countries.} @@ -775,11 +793,18 @@ void QOpenGLWidgetPrivate::resolveSamples() void QOpenGLWidgetPrivate::invokeUserPaint() { Q_Q(QOpenGLWidget); - QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); + + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + Q_ASSERT(ctx && fbo); + + QOpenGLFunctions *f = ctx->functions(); + QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = fbo->handle(); f->glViewport(0, 0, q->width() * q->devicePixelRatio(), q->height() * q->devicePixelRatio()); q->paintGL(); flushPending = true; + + QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = 0; } void QOpenGLWidgetPrivate::render() |