From bb00314e858d0e0ba02c0ac105008e0d0f3d86d7 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 11 Oct 2018 15:30:53 +0200 Subject: Make layersinquick work with non-core GL contexts Change-Id: I5b040615ee0115d0b59fe2c33e28979e5cdc20b6 Reviewed-by: Christian Stromme --- examples/3dstudioruntime2/layersinquick/main.qml | 15 +++++++++++++-- 1 file 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" + @@ -146,6 +146,17 @@ Rectangle { "void main() {\n" + " 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" + "}" } -- cgit v1.2.3