opengl: Correct order of transforms in GLTexturePrivate::updateMatrix

The textureToTransformMatrix should be applied first, otherwise the scale
transform is going to change the winding order of rotations.

In practice though, it shouldn't matter because these matrices are used
to downscale or upscale uv coordinates.
This commit is contained in:
Vlad Zahorodnii 2024-01-18 23:02:30 +02:00
parent 428758d33a
commit cffacc514d

View file

@ -500,14 +500,14 @@ void GLTexturePrivate::updateMatrix()
}
m_matrix[NormalizedCoordinates].translate(0.5, 0.5);
m_matrix[NormalizedCoordinates] *= textureToBufferMatrix;
// our Y axis is flipped vs OpenGL
m_matrix[NormalizedCoordinates].scale(1, -1);
m_matrix[NormalizedCoordinates] *= textureToBufferMatrix;
m_matrix[NormalizedCoordinates].translate(-0.5, -0.5);
m_matrix[UnnormalizedCoordinates].translate(m_size.width() / 2, m_size.height() / 2);
m_matrix[UnnormalizedCoordinates] *= textureToBufferMatrix;
m_matrix[UnnormalizedCoordinates].scale(1, -1);
m_matrix[UnnormalizedCoordinates] *= textureToBufferMatrix;
m_matrix[UnnormalizedCoordinates].translate(-m_size.width() / 2, -m_size.height() / 2);
}