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
This commit is contained in:
parent
0351ea74b2
commit
bd6d332fe7
@ -62,19 +62,19 @@ QList<QByteArray> FadingMaterialShader::attributes() const
|
|||||||
void FadingMaterialShader::updateState(const FadingMaterialState* newState, const FadingMaterialState* oldState)
|
void FadingMaterialShader::updateState(const FadingMaterialState* newState, const FadingMaterialState* oldState)
|
||||||
{
|
{
|
||||||
if (!oldState || oldState->source != newState->source) {
|
if (!oldState || oldState->source != newState->source) {
|
||||||
glFuncs->glActiveTexture(GL_TEXTURE1);
|
glFuncs->glActiveTexture(GL_TEXTURE0);
|
||||||
newState->source->bind();
|
newState->source->bind();
|
||||||
QRectF rect = newState->source->normalizedTextureSubRect();
|
QRectF rect = newState->source->normalizedTextureSubRect();
|
||||||
program()->setUniformValue(m_sourceRectId, QVector4D(rect.x(), rect.y(), rect.width(), rect.height()));
|
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) {
|
if (!oldState || oldState->target != newState->target) {
|
||||||
glFuncs->glActiveTexture(GL_TEXTURE0);
|
glFuncs->glActiveTexture(GL_TEXTURE1);
|
||||||
newState->target->bind();
|
newState->target->bind();
|
||||||
QRectF rect = newState->target->normalizedTextureSubRect();
|
QRectF rect = newState->target->normalizedTextureSubRect();
|
||||||
program()->setUniformValue(m_targetRectId, QVector4D(rect.x(), rect.y(), rect.width(), rect.height()));
|
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) {
|
if (!oldState || oldState->progress != newState->progress) {
|
||||||
|
Loading…
Reference in New Issue
Block a user