diff options
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 24 | ||||
-rw-r--r-- | src/opengl/qpixmapdata_gl.cpp | 8 |
2 files changed, 14 insertions, 18 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 2eacef0..4427ee9 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1318,23 +1318,13 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) return false; d->ctx = d->device->context(); - d->ctx->d_ptr->active_engine = this; - d->last_created_state = 0; - QSize sz = d->device->size(); + const QSize sz = d->device->size(); d->width = sz.width(); d->height = sz.height(); + d->last_created_state = 0; d->mode = BrushDrawingMode; - -#if !defined(QT_OPENGL_ES_2) - d->ctx->makeCurrent(); - bool success = qt_resolve_version_2_0_functions(d->ctx); - Q_ASSERT(success); -#endif - - d->shaderManager = new QGLEngineShaderManager(d->ctx); - d->brushTextureDirty = true; d->brushUniformsDirty = true; d->matrixDirty = true; @@ -1346,8 +1336,18 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) d->needsSync = true; d->use_system_clip = !systemClip().isEmpty(); + // Calling begin paint should make the correct context current. So, any + // code which calls into GL or otherwise needs a current context *must* + // go after beginPaint: d->device->beginPaint(); +#if !defined(QT_OPENGL_ES_2) + bool success = qt_resolve_version_2_0_functions(d->ctx); + Q_ASSERT(success); +#endif + + d->shaderManager = new QGLEngineShaderManager(d->ctx); + if (!d->inRenderText) { glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index fa1b815..0bc46e1 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -157,12 +157,8 @@ void QGLPixmapGLPaintDevice::beginPaint() // uploaded from an image or rendered into before), we need to // copy it from the texture to the render FBO. - // Pass false to tell bind to _not_ copy the FBO into the texture! - GLuint texId = data->bind(false); - - QGL2PaintEngineEx* pe = static_cast<QGL2PaintEngineEx*>(data->paintEngine()); - QRect rect(0, 0, data->width(), data->height()); - pe->drawTexture(QRectF(rect), texId, rect.size(), QRectF(rect)); + // Pass false to bind so it doesn't copy the FBO into the texture! + context()->drawTexture(QPointF(0.0, 0.0), data->bind(false)); } } |