aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickitemlayer/data
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2015-08-10 14:33:14 +0300
committerMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2015-08-20 09:49:18 +0000
commit3f4d7a755585f1b79c7e9675220b8210f10f358e (patch)
tree50e4e4faef56413bede418bcf495ca7fe41677ba /tests/auto/quick/qquickitemlayer/data
parent04f30db289225e700fe99c163f53f0dd7e920caf (diff)
Add possibility to mirror ShaderEffectSource generated textures
Using textures generated by ShaderEffectSource items (or Item.layer) with custom OpenGL code was non-intuitive due to mismatching coordinate systems, so added a possibility to control the generated texture orientation. [ChangeLog][QtQuick][ShaderEffectSource] Added possibility to mirror generated OpenGL texture. Change-Id: I7c03d8b6fbfc43d69812c15d244200fb8e7c7bb9 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'tests/auto/quick/qquickitemlayer/data')
-rw-r--r--tests/auto/quick/qquickitemlayer/data/TextureMirroring.qml159
1 files changed, 159 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickitemlayer/data/TextureMirroring.qml b/tests/auto/quick/qquickitemlayer/data/TextureMirroring.qml
new file mode 100644
index 0000000000..2827960153
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/TextureMirroring.qml
@@ -0,0 +1,159 @@
+import QtQuick 2.6
+
+Item
+{
+ width: 250
+ height: 50
+
+ property int mirroring: 0
+
+ // Layered box without effect. Mirroring should not affect how it looks.
+ Rectangle {
+ x: 0
+ y: 0
+ width: 50
+ height: 50
+ layer.enabled: true
+ layer.textureMirroring: mirroring
+ Rectangle {
+ x: 0
+ y: 0
+ width: 25
+ height: 25
+ color: "#000000"
+ }
+ Rectangle {
+ x: 25
+ y: 0
+ width: 25
+ height: 25
+ color: "#ff0000"
+ }
+ Rectangle {
+ x: 0
+ y: 25
+ width: 25
+ height: 25
+ color: "#00ff00"
+ }
+ Rectangle {
+ x: 25
+ y: 25
+ width: 25
+ height: 25
+ color: "#0000ff"
+ }
+ }
+
+ // Layered box with effect. Mirroring should affect how it looks.
+ Rectangle {
+ id: layeredEffectBox
+ x: 50
+ y: 0
+ width: 50
+ height: 50
+ layer.enabled: true
+ layer.textureMirroring: mirroring
+ layer.samplerName: "source"
+ layer.effect: ShaderEffect {
+ property variant source: layeredEffectBox
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor = texture2D(source, qt_TexCoord0);
+ }"
+
+ }
+
+ Rectangle {
+ x: 0
+ y: 0
+ width: 25
+ height: 25
+ color: "#000000"
+ }
+ Rectangle {
+ x: 25
+ y: 0
+ width: 25
+ height: 25
+ color: "#ff0000"
+ }
+ Rectangle {
+ x: 0
+ y: 25
+ width: 25
+ height: 25
+ color: "#00ff00"
+ }
+ Rectangle {
+ x: 25
+ y: 25
+ width: 25
+ height: 25
+ color: "#0000ff"
+ }
+ }
+
+ // Non-layered source item for ShaderEffectSource. Mirroring should not affect how it looks.
+ Rectangle {
+ id: box2
+ x: 100
+ y: 0
+ width: 50
+ height: 50
+ Rectangle {
+ x: 0
+ y: 0
+ width: 25
+ height: 25
+ color: "#000000"
+ }
+ Rectangle {
+ x: 25
+ y: 0
+ width: 25
+ height: 25
+ color: "#ff0000"
+ }
+ Rectangle {
+ x: 0
+ y: 25
+ width: 25
+ height: 25
+ color: "#00ff00"
+ }
+ Rectangle {
+ x: 25
+ y: 25
+ width: 25
+ height: 25
+ color: "#0000ff"
+ }
+ }
+ // ShaderEffectSource item. Mirroring should not affect how it looks.
+ ShaderEffectSource {
+ id: theSource
+ x: 150
+ y: 0
+ width: 50
+ height: 50
+ sourceItem: box2
+ textureMirroring: mirroring
+ }
+ // ShaderEffect item. Mirroring should affect how it looks.
+ ShaderEffect {
+ x: 200
+ y: 0
+ width: 50
+ height: 50
+ property variant source: theSource
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor = texture2D(source, qt_TexCoord0);
+ }"
+ }
+}