From 7738ed4a18699d9d96f14dfe08dcc5ddfacf848f Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Wed, 30 Aug 2017 15:57:30 +0300 Subject: Fix broken native text rendering with Mapbox GL plugin Mapbox is "leaking" the pixel storage mode. So we need to restore it after we render otherwise it breaks native text rendering. Task-number: QTBUG-62861 Change-Id: I12643e34e462cce58cdf30da52ab927499f38442 Reviewed-by: Paolo Angelelli --- src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp b/src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp index 3f31997c..82aa868f 100644 --- a/src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp +++ b/src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp @@ -88,10 +88,16 @@ void QSGMapboxGLTextureNode::render(QQuickWindow *window) QOpenGLFunctions *f = window->openglContext()->functions(); f->glViewport(0, 0, m_fbo->width(), m_fbo->height()); + GLint alignment; + f->glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment); + m_fbo->bind(); m_map->render(); m_fbo->release(); + // QTBUG-62861 + f->glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); + window->resetOpenGLState(); markDirty(QSGNode::DirtyMaterial); } @@ -125,7 +131,13 @@ void QSGMapboxGLRenderNode::render(const RenderState *state) f->glScissor(state->scissorRect().x(), state->scissorRect().y(), state->scissorRect().width(), state->scissorRect().height()); f->glEnable(GL_SCISSOR_TEST); + GLint alignment; + f->glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment); + m_map->render(); + + // QTBUG-62861 + f->glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); } QSGRenderNode::StateFlags QSGMapboxGLRenderNode::changedStates() const -- cgit v1.2.1