diff options
author | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-01-06 09:38:52 +0100 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-01-06 09:38:52 +0100 |
commit | 6cd3a7c29e2a53996a6ebee8bdfc2545a3e2ca65 (patch) | |
tree | 9059440c5e65b1c7e8b78723a92166e38cd722df | |
parent | c6e8920370df5fbb033a1c6fc78d472a711248be (diff) |
Testcase for shader effects where one source is used twice
-rw-r--r-- | tests/ShaderEffectTwiceOnSameSource.qml | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/ShaderEffectTwiceOnSameSource.qml b/tests/ShaderEffectTwiceOnSameSource.qml new file mode 100644 index 0000000..2263dce --- /dev/null +++ b/tests/ShaderEffectTwiceOnSameSource.qml @@ -0,0 +1,49 @@ +import QtQuick 2.0 + +Item { + width: 400 + height: 300 + + Text { + id: text + anchors.centerIn: parent + font.pixelSize: 80 + text: "Shaderz!" + } + + ShaderEffectSource { + id: source + sourceItem: text + } + + ShaderEffectItem { + width: parent.width + height: parent.height / 2 + + property variant source: source + + fragmentShader: " + uniform lowp sampler2D source; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; + } + " + } + + ShaderEffectItem { + width: parent.width + y: parent.height / 2 + height: parent.height / 2 + + property variant source: source + + fragmentShader: " + uniform lowp sampler2D source; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = vec4(qt_TexCoord0.x, 1, 0, 1) * texture2D(source, qt_TexCoord0).a; + } + " + } +} |