opengl: Correct transformation order in GLTexture::render()
First, the texture-to-buffer transform has to be applied, then the y axis should be flipped. Doing it vice versa changes the winding order of rotation transforms. Also the screenshot plugin uses incorrect render transform. Since convertFromGLImage() undoes the render target's transform, the color space transformation pass should use the same transform, not the inverted one. BUG: 479934
This commit is contained in:
parent
69f8bee0b1
commit
f23e0ef05b
2 changed files with 5 additions and 2 deletions
|
@ -360,9 +360,9 @@ void GLTexture::render(const QRectF &source, const QRegion ®ion, const QSizeF
|
|||
|
||||
QMatrix4x4 textureMat;
|
||||
textureMat.translate(texWidth / 2, texHeight / 2);
|
||||
textureMat *= d->m_textureToBufferTransform.toMatrix();
|
||||
// our Y axis is flipped vs OpenGL
|
||||
textureMat.scale(1, -1);
|
||||
textureMat *= d->m_textureToBufferTransform.toMatrix();
|
||||
textureMat.translate(-texWidth / 2, -texHeight / 2);
|
||||
textureMat.scale(texWidth / rotatedSize.width(), texHeight / rotatedSize.height());
|
||||
|
||||
|
|
|
@ -386,7 +386,10 @@ QImage ScreenShotEffect::blitScreenshot(const RenderTarget &renderTarget, const
|
|||
GLFramebuffer::pushFramebuffer(&target);
|
||||
ShaderBinder binder(ShaderTrait::MapTexture | ShaderTrait::TransformColorspace);
|
||||
binder.shader()->setColorspaceUniformsToSRGB(renderTarget.colorDescription());
|
||||
QMatrix4x4 projectionMatrix = renderTarget.texture()->contentTransform().inverted().toMatrix();
|
||||
QMatrix4x4 projectionMatrix;
|
||||
projectionMatrix.scale(1, -1);
|
||||
projectionMatrix *= renderTarget.transform().toMatrix();
|
||||
projectionMatrix.scale(1, -1);
|
||||
projectionMatrix.ortho(QRect(QPoint(), nativeSize));
|
||||
binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, projectionMatrix);
|
||||
renderTarget.texture()->render(viewport.mapToRenderTargetTexture(geometry), infiniteRegion(), nativeSize);
|
||||
|
|
Loading…
Reference in a new issue