Commit 5c722557 authored by Sean Harmer's avatar Sean Harmer Committed by The Qt Project
Browse files

Add a way of transforming texture coordinates of a simple textured quad

This commit introduces the enum TextureCoordinatesTransformFlag and
corresponding QFlags OR combination TextureCoordinatesTransformMode.
This enum is used to control the orientation of texture coordinates
relative to window/item coordinates.

The common use case addressed by this commit is when rendering to a
texture via an FBO using some 3rd party OpenGL library. Some libraries
do not offer a way to orient the rendered output which results in the
texture being displayed upside down when used in conjunction with
QSGSimpleTextureNode.

There are a number of possible solutions to this:

1 Mirror the item by scaling by -1 in the y-direction in QML document

2 Use a custom material (shader) that transforms texture coordinates
  in GLSL

3 Generate texture coordinates differently

This commit opts for approach 3. Approach 1 is ugly and visible to the
end user and also causes more work when other transformations interact
with the necessary ...
parent a6ccf8b4
Showing with 93 additions and 4 deletions
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment