diff options
| author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-08-06 12:55:02 +0200 |
|---|---|---|
| committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-08-07 11:20:17 +0000 |
| commit | b122e0e32308d95e75aca2fe8f4391180e3c269b (patch) | |
| tree | 3f3bdc314603ce9ec94ae81754a09abee4f36cdd /src/opengl/qglpaintdevice.cpp | |
| parent | 70b7b2bffc09278e1f7210268ffcc871bc6d1c0f (diff) | |
Guard QGL2PaintEngineEx/QGLPaintDevice against using unset context
QGL2PaintEngineEx::end() calls endPaint() on the device, which may end up
calling QGLContext::swapBuffers() on the context, a call which we have
documented to require makeCurrent() for any further GL commands:
Call this to finish a frame of OpenGL rendering, and make sure to
call makeCurrent() again before issuing any further OpenGL commands,
for example as part of a new frame.
QOpenGLContext also documents that:
To be able to support certain platforms, QOpenGLContext requires that
you call makeCurrent() again before starting rendering a new frame,
after calling swapBuffers().
As a consequence, we need to guard the GL usage in QGLPaintDevice::endPaint(),
as well as the GL reset in QGL2PaintEngineEx::end().
Change-Id: Ib66e91cce12fbaea32ed3c30141150fa15907187
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/opengl/qglpaintdevice.cpp')
| -rw-r--r-- | src/opengl/qglpaintdevice.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp index b29f71ad2e4..c5151f66bb0 100644 --- a/src/opengl/qglpaintdevice.cpp +++ b/src/opengl/qglpaintdevice.cpp @@ -126,6 +126,7 @@ void QGLPaintDevice::endPaint() { // Make sure the FBO bound at beginPaint is re-bound again here: QGLContext *ctx = context(); + ctx->makeCurrent(); ctx->d_func()->refreshCurrentFbo(); |
