From bd6d332fe795c315fed7ab9825637accb534c000 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 10 Jul 2018 10:11:47 +0200 Subject: [PATCH] Fix fading node when one textured is atlassed. source and target were swapped in both the QSGNode::updateState/bind and in the fragment shader. When Atlas support was added, the texture position was put the right way round; which made things backwards so source/target also got swapped instead of fixed properly. But this leads a glitch if one texture was in the atlas and one wasn't (not common) This puts everything the right way round again. Reviewed-by: Kai Broulik --- src/declarativeimports/core/fadingnode.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/declarativeimports/core/fadingnode.cpp b/src/declarativeimports/core/fadingnode.cpp index 690f3c9e4..aacc5f059 100644 --- a/src/declarativeimports/core/fadingnode.cpp +++ b/src/declarativeimports/core/fadingnode.cpp @@ -62,19 +62,19 @@ QList FadingMaterialShader::attributes() const void FadingMaterialShader::updateState(const FadingMaterialState* newState, const FadingMaterialState* oldState) { if (!oldState || oldState->source != newState->source) { - glFuncs->glActiveTexture(GL_TEXTURE1); + glFuncs->glActiveTexture(GL_TEXTURE0); newState->source->bind(); QRectF rect = newState->source->normalizedTextureSubRect(); program()->setUniformValue(m_sourceRectId, QVector4D(rect.x(), rect.y(), rect.width(), rect.height())); - // reset the active texture back to 0 after we changed it to something else - glFuncs->glActiveTexture(GL_TEXTURE0); } if (!oldState || oldState->target != newState->target) { - glFuncs->glActiveTexture(GL_TEXTURE0); + glFuncs->glActiveTexture(GL_TEXTURE1); newState->target->bind(); QRectF rect = newState->target->normalizedTextureSubRect(); program()->setUniformValue(m_targetRectId, QVector4D(rect.x(), rect.y(), rect.width(), rect.height())); + // reset the active texture back to 0 after we changed it to something else + glFuncs->glActiveTexture(GL_TEXTURE0); } if (!oldState || oldState->progress != newState->progress) {