summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2018-10-11 15:30:53 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-10-12 12:16:00 +0000
commitbb00314e858d0e0ba02c0ac105008e0d0f3d86d7 (patch)
treeb811bc809cc6f8dd752cfacc9a85699c261ebe3c
parent91dba60d9f7d6291ff51a8f716f7cb5a0a6b61ac (diff)
Make layersinquick work with non-core GL contexts
Change-Id: I5b040615ee0115d0b59fe2c33e28979e5cdc20b6 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
-rw-r--r--examples/3dstudioruntime2/layersinquick/main.qml15
1 files changed, 13 insertions, 2 deletions
diff --git a/examples/3dstudioruntime2/layersinquick/main.qml b/examples/3dstudioruntime2/layersinquick/main.qml
index f7e3d39..e129f4d 100644
--- a/examples/3dstudioruntime2/layersinquick/main.qml
+++ b/examples/3dstudioruntime2/layersinquick/main.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.0
+import QtQuick 2.8
import QtStudio3D 2.2
import QtQuick.Controls 2.2
@@ -134,7 +134,7 @@ Rectangle {
property real frequency: 20
property real time: 0
NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 }
- fragmentShader:
+ fragmentShader: GraphicsInfo.profile === GraphicsInfo.OpenGLCoreProfile ?
"#version 330 core\n" +
"uniform float qt_Opacity;\n" +
"uniform float amplitude;\n" +
@@ -147,6 +147,17 @@ Rectangle {
" vec2 p = sin(time + frequency * qt_TexCoord0);\n" +
" fragColor = texture(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;\n" +
"}"
+ :
+ "uniform float qt_Opacity;\n" +
+ "uniform float amplitude;\n" +
+ "uniform float frequency;\n" +
+ "uniform float time;\n" +
+ "uniform sampler2D source;\n" +
+ "varying vec2 qt_TexCoord0;\n" +
+ "void main() {\n" +
+ " vec2 p = sin(time + frequency * qt_TexCoord0);\n" +
+ " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;\n" +
+ "}"
}
Text {