diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2010-12-07 10:44:49 +0100 |
---|---|---|
committer | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2010-12-07 10:58:07 +0100 |
commit | 8ab14c354cf5a426295c55f6a62b07d0fde2c805 (patch) | |
tree | c22c113df0836bde6f498e1dedda96c3fab7cd89 | |
parent | 3dfa704668e935cad3d40e62fc03fe61266b9d21 (diff) |
Changed the names of shader variables to match Qt3D.
qt_Matrix -> qt_ModelViewProjectionMatrix
qt_TexCoord -> qt_TexCoord0
Task-number: QTBUG-15565
-rw-r--r-- | examples/shadereffectitem/Effectoids/Box4PointBlur.qml | 12 | ||||
-rw-r--r-- | examples/shadereffectitem/Effectoids/Colorize.qml | 12 | ||||
-rw-r--r-- | examples/shadereffectitem/Effectoids/Directional4PointBlur.qml | 12 | ||||
-rw-r--r-- | examples/shadereffectitem/Effectoids/Directional8PointBlur.qml | 12 | ||||
-rw-r--r-- | examples/shadereffectitem/Effectoids/DropShadow.qml | 12 | ||||
-rw-r--r-- | src/effects/shadereffectitem.cpp | 32 | ||||
-rw-r--r-- | tests/effects.qml | 77 | ||||
-rw-r--r-- | tests/opacityeffect.qml | 4 |
8 files changed, 107 insertions, 66 deletions
diff --git a/examples/shadereffectitem/Effectoids/Box4PointBlur.qml b/examples/shadereffectitem/Effectoids/Box4PointBlur.qml index 2f5ac01..e2486a9 100644 --- a/examples/shadereffectitem/Effectoids/Box4PointBlur.qml +++ b/examples/shadereffectitem/Effectoids/Box4PointBlur.qml @@ -44,14 +44,14 @@ import QtQuick 2.0 ShaderEffectItem { fragmentShader: - "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "varying highp vec2 my_TexCoord2; \n" + "varying highp vec2 my_TexCoord3; \n" + "varying highp vec2 my_TexCoord4; \n" + "uniform lowp sampler2D source; \n" + "uniform highp float qt_Opacity; \n" + "void main() { \n" + - " gl_FragColor = qt_Opacity * (texture2D(source, qt_TexCoord) \n" + + " gl_FragColor = qt_Opacity * (texture2D(source, qt_TexCoord0) \n" + " + texture2D(source, my_TexCoord2) \n" + " + texture2D(source, my_TexCoord3) \n" + " + texture2D(source, my_TexCoord4)) * 0.25; \n" + @@ -60,11 +60,11 @@ ShaderEffectItem vertexShader: "attribute highp vec4 qt_Vertex; \n" + "attribute highp vec2 qt_MultiTexCoord0; \n" + - "uniform highp mat4 qt_Matrix; \n" + + "uniform highp mat4 qt_ModelViewProjectionMatrix; \n" + "uniform highp float xOffset; \n" + "uniform highp float yOffset; \n" + "uniform highp vec2 _normMargins; \n" + - "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "varying highp vec2 my_TexCoord2; \n" + "varying highp vec2 my_TexCoord3; \n" + "varying highp vec2 my_TexCoord4; \n" + @@ -73,11 +73,11 @@ ShaderEffectItem " highp vec2 s2 = vec2(-xOffset, yOffset); \n" + " highp vec2 tcoord = mix(_normMargins, \n" + " qt_MultiTexCoord0 - _normMargins, qt_MultiTexCoord0); \n" + - " qt_TexCoord = tcoord + s1; \n" + + " qt_TexCoord0 = tcoord + s1; \n" + " my_TexCoord2 = tcoord - s1; \n" + " my_TexCoord3 = tcoord + s2; \n" + " my_TexCoord4 = tcoord - s2; \n" + - " gl_Position = qt_Matrix * qt_Vertex; \n" + + " gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex; \n" + "}" property real xOffset: 0.5 / width diff --git a/examples/shadereffectitem/Effectoids/Colorize.qml b/examples/shadereffectitem/Effectoids/Colorize.qml index 3d2c994..7bf0e88 100644 --- a/examples/shadereffectitem/Effectoids/Colorize.qml +++ b/examples/shadereffectitem/Effectoids/Colorize.qml @@ -44,13 +44,13 @@ import QtQuick 2.0 ShaderEffectItem { fragmentShader: - "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "uniform lowp sampler2D source; \n" + "uniform lowp vec4 color; \n" + "uniform lowp float intensity; \n" + "uniform lowp float qt_Opacity; \n" + "void main() { \n" + - " lowp vec4 pix = texture2D(source, qt_TexCoord); \n" + + " lowp vec4 pix = texture2D(source, qt_TexCoord0); \n" + " lowp float gray = dot(pix.xyz, vec3(0.5, 0.5, 0.5)); \n" + " gl_FragColor = qt_Opacity * mix(pix, vec4(color.xyz * gray, pix.w), intensity); \n" + "}" @@ -58,11 +58,11 @@ ShaderEffectItem vertexShader: "attribute highp vec4 qt_Vertex; \n" + "attribute highp vec2 qt_MultiTexCoord0; \n" + - "uniform highp mat4 qt_Matrix; \n" + - "varying highp vec2 qt_TexCoord; \n" + + "uniform highp mat4 qt_ModelViewProjectionMatrix; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "void main() { \n" + - " qt_TexCoord = qt_MultiTexCoord0; \n" + - " gl_Position = qt_Matrix * qt_Vertex; \n" + + " qt_TexCoord0 = qt_MultiTexCoord0; \n" + + " gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex; \n" + "}" property color color; diff --git a/examples/shadereffectitem/Effectoids/Directional4PointBlur.qml b/examples/shadereffectitem/Effectoids/Directional4PointBlur.qml index 4a745b4..b2d5d22 100644 --- a/examples/shadereffectitem/Effectoids/Directional4PointBlur.qml +++ b/examples/shadereffectitem/Effectoids/Directional4PointBlur.qml @@ -44,14 +44,14 @@ import QtQuick 2.0 ShaderEffectItem { fragmentShader: - "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "varying highp vec2 qt_TexCoord2; \n" + "varying highp vec2 qt_TexCoord3; \n" + "varying highp vec2 qt_TexCoord4; \n" + "uniform lowp sampler2D source; \n" + "uniform highp float qt_Opacity; \n" + "void main() { \n" + - " gl_FragColor = qt_Opacity * (2. / 6. * texture2D(source, qt_TexCoord) \n" + + " gl_FragColor = qt_Opacity * (2. / 6. * texture2D(source, qt_TexCoord0) \n" + " + 1. / 6. * texture2D(source, qt_TexCoord2) \n" + " + 2. / 6. * texture2D(source, qt_TexCoord3) \n" + " + 1. / 6. * texture2D(source, qt_TexCoord4)); \n" + @@ -60,21 +60,21 @@ ShaderEffectItem vertexShader: "attribute highp vec4 qt_Vertex; \n" + "attribute highp vec2 qt_MultiTexCoord0; \n" + - "uniform highp mat4 qt_Matrix; \n" + + "uniform highp mat4 qt_ModelViewProjectionMatrix; \n" + "uniform highp float xStep; \n" + "uniform highp float yStep; \n" + "uniform highp float spread; \n" + - "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "varying highp vec2 qt_TexCoord2; \n" + "varying highp vec2 qt_TexCoord3; \n" + "varying highp vec2 qt_TexCoord4; \n" + "void main() { \n" + " highp vec2 shift = vec2(xStep, yStep) * spread; \n" + - " qt_TexCoord = 0.7 * shift + qt_MultiTexCoord0; \n" + + " qt_TexCoord0 = 0.7 * shift + qt_MultiTexCoord0; \n" + " qt_TexCoord2 = 2.7 * shift + qt_MultiTexCoord0; \n" + " qt_TexCoord3 = -0.7 * shift + qt_MultiTexCoord0; \n" + " qt_TexCoord4 = -2.7 * shift + qt_MultiTexCoord0; \n" + - " gl_Position = qt_Matrix * qt_Vertex; \n" + + " gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex; \n" + "}" diff --git a/examples/shadereffectitem/Effectoids/Directional8PointBlur.qml b/examples/shadereffectitem/Effectoids/Directional8PointBlur.qml index 940c50d..45a60f5 100644 --- a/examples/shadereffectitem/Effectoids/Directional8PointBlur.qml +++ b/examples/shadereffectitem/Effectoids/Directional8PointBlur.qml @@ -44,7 +44,7 @@ import QtQuick 2.0 ShaderEffectItem { fragmentShader: - "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "varying highp vec2 qt_TexCoord2; \n" + "varying highp vec2 qt_TexCoord3; \n" + "varying highp vec2 qt_TexCoord4; \n" + @@ -55,7 +55,7 @@ ShaderEffectItem "uniform lowp sampler2D source; \n" + "uniform highp float qt_Opacity; \n" + "void main() { \n" + - " gl_FragColor = qt_Opacity * (4. / 20. * texture2D(source, qt_TexCoord) \n" + + " gl_FragColor = qt_Opacity * (4. / 20. * texture2D(source, qt_TexCoord0) \n" + " + 3. / 20. * texture2D(source, qt_TexCoord2) \n" + " + 2. / 20. * texture2D(source, qt_TexCoord3) \n" + " + 1. / 20. * texture2D(source, qt_TexCoord4) \n" + @@ -68,11 +68,11 @@ ShaderEffectItem vertexShader: "attribute highp vec4 qt_Vertex; \n" + "attribute highp vec2 qt_MultiTexCoord0; \n" + - "uniform highp mat4 qt_Matrix; \n" + + "uniform highp mat4 qt_ModelViewProjectionMatrix; \n" + "uniform highp float xStep; \n" + "uniform highp float yStep; \n" + "uniform highp float spread; \n" + - "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "varying highp vec2 qt_TexCoord2; \n" + "varying highp vec2 qt_TexCoord3; \n" + "varying highp vec2 qt_TexCoord4; \n" + @@ -82,7 +82,7 @@ ShaderEffectItem "varying highp vec2 qt_TexCoord8; \n" + "void main() { \n" + " highp vec2 shift = vec2(xStep, yStep) * spread; \n" + - " qt_TexCoord = 0.66 * shift + qt_MultiTexCoord0; \n" + + " qt_TexCoord0 = 0.66 * shift + qt_MultiTexCoord0; \n" + " qt_TexCoord2 = 2.5 * shift + qt_MultiTexCoord0; \n" + " qt_TexCoord3 = 4.5 * shift + qt_MultiTexCoord0; \n" + " qt_TexCoord4 = 6.5 * shift + qt_MultiTexCoord0; \n" + @@ -90,7 +90,7 @@ ShaderEffectItem " qt_TexCoord6 = -2.5 * shift + qt_MultiTexCoord0; \n" + " qt_TexCoord7 = -4.5 * shift + qt_MultiTexCoord0; \n" + " qt_TexCoord8 = -6.5 * shift + qt_MultiTexCoord0; \n" + - " gl_Position = qt_Matrix * qt_Vertex; \n" + + " gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex; \n" + "}" property real spread: 1 diff --git a/examples/shadereffectitem/Effectoids/DropShadow.qml b/examples/shadereffectitem/Effectoids/DropShadow.qml index 8c45e88..b626087 100644 --- a/examples/shadereffectitem/Effectoids/DropShadow.qml +++ b/examples/shadereffectitem/Effectoids/DropShadow.qml @@ -44,14 +44,14 @@ import QtQuick 2.0 ShaderEffectItem { fragmentShader: - "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "varying highp vec2 my_TexCoord1; \n" + "varying highp vec2 my_TexCoord2; \n" + "varying highp vec2 my_TexCoord3; \n" + "varying highp vec2 my_TexCoord4; \n" + "uniform sampler2D source; \n" + "void main() { \n" + - " lowp vec4 pix = texture2D(source, qt_TexCoord); \n" + + " lowp vec4 pix = texture2D(source, qt_TexCoord0); \n" + " lowp float shadow = (texture2D(source, my_TexCoord1).w \n" + " + texture2D(source, my_TexCoord2).w \n" + " + texture2D(source, my_TexCoord3).w \n" + @@ -62,12 +62,12 @@ ShaderEffectItem vertexShader: "attribute highp vec4 qt_Vertex; \n" + "attribute highp vec2 qt_MultiTexCoord0; \n" + - "uniform highp mat4 qt_Matrix; \n" + + "uniform highp mat4 qt_ModelViewProjectionMatrix; \n" + "uniform highp float xOffset; \n" + "uniform highp float xDisplacement; \n" + "uniform highp float yOffset; \n" + "uniform highp float yDisplacement; \n" + - "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "varying highp vec2 my_TexCoord1; \n" + "varying highp vec2 my_TexCoord2; \n" + "varying highp vec2 my_TexCoord3; \n" + @@ -75,13 +75,13 @@ ShaderEffectItem "void main() { \n" + " highp vec2 s1 = vec2(xOffset, yOffset); \n" + " highp vec2 s2 = vec2(-xOffset, yOffset); \n" + - " qt_TexCoord = qt_MultiTexCoord0; \n" + + " qt_TexCoord0 = qt_MultiTexCoord0; \n" + " vec2 shadowPos = qt_MultiTexCoord0 + vec2(-xDisplacement, yDisplacement); \n" + " my_TexCoord1 = shadowPos + s1; \n" + " my_TexCoord2 = shadowPos - s1; \n" + " my_TexCoord3 = shadowPos + s2; \n" + " my_TexCoord4 = shadowPos - s2; \n" + - " gl_Position = qt_Matrix * qt_Vertex; \n" + + " gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex; \n" + "}" property real xOffset: 0.66 / width; diff --git a/src/effects/shadereffectitem.cpp b/src/effects/shadereffectitem.cpp index 4563a35..0826b8a 100644 --- a/src/effects/shadereffectitem.cpp +++ b/src/effects/shadereffectitem.cpp @@ -52,20 +52,20 @@ #include <QtGui/qimagereader.h> static const char qt_default_vertex_code[] = - "uniform highp mat4 qt_Matrix; \n" - "attribute highp vec4 qt_Vertex; \n" - "attribute highp vec2 qt_MultiTexCoord0; \n" - "varying highp vec2 qt_TexCoord; \n" - "void main() { \n" - " qt_TexCoord = qt_MultiTexCoord0; \n" - " gl_Position = qt_Matrix * qt_Vertex; \n" + "uniform highp mat4 qt_ModelViewProjectionMatrix; \n" + "attribute highp vec4 qt_Vertex; \n" + "attribute highp vec2 qt_MultiTexCoord0; \n" + "varying highp vec2 qt_TexCoord0; \n" + "void main() { \n" + " qt_TexCoord0 = qt_MultiTexCoord0; \n" + " gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex; \n" "}"; static const char qt_default_fragment_code[] = - "varying highp vec2 qt_TexCoord; \n" - "uniform lowp sampler2D source; \n" - "void main() { \n" - " gl_FragColor = texture2D(source, qt_TexCoord); \n" + "varying highp vec2 qt_TexCoord0; \n" + "uniform lowp sampler2D source; \n" + "void main() { \n" + " gl_FragColor = texture2D(source, qt_TexCoord0); \n" "}"; class CustomShaderMaterialData : public AbstractEffectProgram @@ -100,7 +100,7 @@ void CustomShaderMaterialData::deactivate() void CustomShaderMaterialData::updateRendererState(Renderer *renderer, Renderer::Updates updates) { if ((updates & Renderer::UpdateMatrices) && q->m_respects_matrix) - q->m_program.setUniformValue("qt_Matrix", renderer->combinedMatrix()); + q->m_program.setUniformValue("qt_ModelViewProjectionMatrix", renderer->combinedMatrix()); } void CustomShaderMaterialData::updateEffectState(Renderer *r, AbstractEffect *newEffect, AbstractEffect *oldEffect) @@ -948,7 +948,7 @@ void ShaderEffectItem::updateShaderProgram() if (!m_attributes.contains(QGL::TextureCoord0)) qWarning("ShaderEffectItem: Missing reference to \'qt_MultiTexCoord0\'."); if (!m_respects_matrix) - qWarning("ShaderEffectItem: Missing reference to \'qt_Matrix\'."); + qWarning("ShaderEffectItem: Missing reference to \'qt_ModelViewProjectionMatrix\'."); if (m_program.isLinked()) { m_program.bind(); @@ -973,10 +973,10 @@ void ShaderEffectItem::lookThroughShaderCode(const QString &code) QString name = re.cap(3); // variable name if (decl == QLatin1String("attribute")) { - if (name == QLatin1String("qt_Vertex") || name == QLatin1String("qt_VertexPosition")) { + if (name == QLatin1String("qt_Vertex")) { m_attributeNames.append(name.toLatin1()); m_attributes.append(QGL::Position); - } else if (name == QLatin1String("qt_MultiTexCoord0") || name == QLatin1String("qt_VertexTexCoord")) { + } else if (name == QLatin1String("qt_MultiTexCoord0")) { m_attributeNames.append(name.toLatin1()); m_attributes.append(QGL::TextureCoord0); } else { @@ -986,7 +986,7 @@ void ShaderEffectItem::lookThroughShaderCode(const QString &code) } else { Q_ASSERT(decl == QLatin1String("uniform")); - if (name == QLatin1String("qt_Matrix")) { + if (name == QLatin1String("qt_ModelViewProjectionMatrix")) { m_respects_matrix = true; } else if (name == QLatin1String("qt_Opacity")) { m_respects_opacity = true; diff --git a/tests/effects.qml b/tests/effects.qml index a7d9ab2..e55bb88 100644 --- a/tests/effects.qml +++ b/tests/effects.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt scene graph research project. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + import QtQuick 2.0 Rectangle { @@ -455,9 +496,9 @@ Rectangle { anchors.fill: parent fragmentShader: "uniform highp float qt_Opacity; \n" + - "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "void main() { \n" + - " highp float x = 6. * qt_TexCoord.x; \n" + + " highp float x = 6. * qt_TexCoord0.x; \n" + " highp float r = max(2. - x, x - 4.); \n" + " highp float g = min(x, 4. - x); \n" + " highp float b = min(x - 2., 6. - x); \n" + @@ -537,13 +578,13 @@ Rectangle { property variant source: defaultSource property real intensity fragmentShader: - "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "uniform lowp sampler2D source; \n" + "uniform lowp vec4 color; \n" + "uniform lowp float intensity; \n" + "uniform lowp float qt_Opacity; \n" + "void main() { \n" + - " lowp vec4 pix = texture2D(source, qt_TexCoord); \n" + + " lowp vec4 pix = texture2D(source, qt_TexCoord0); \n" + " lowp float gray = dot(pix.xyz, vec3(0.5, 0.5, 0.5)); \n" + " gl_FragColor = qt_Opacity * mix(pix, vec4(color.xyz * gray, pix.w), intensity); \n" + "}" @@ -627,7 +668,7 @@ Rectangle { } property string blurShader: - "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "uniform lowp sampler2D _source; \n" + "uniform highp vec4 offsets; \n" + "uniform highp vec4 weights; \n" + @@ -635,27 +676,27 @@ Rectangle { "uniform lowp float qt_Opacity; \n" + "void main() { \n" + " highp vec4 sum = vec4(0.); \n" + - " sum += texture2D(_source, qt_TexCoord - direction * offsets.x) * weights.x; \n" + - " sum += texture2D(_source, qt_TexCoord - direction * offsets.y) * weights.y; \n" + - " sum += texture2D(_source, qt_TexCoord - direction * offsets.z) * weights.z; \n" + - " sum += texture2D(_source, qt_TexCoord - direction * offsets.w) * weights.w; \n" + - " sum += texture2D(_source, qt_TexCoord + direction * offsets.x) * weights.x; \n" + - " sum += texture2D(_source, qt_TexCoord + direction * offsets.y) * weights.y; \n" + - " sum += texture2D(_source, qt_TexCoord + direction * offsets.z) * weights.z; \n" + - " sum += texture2D(_source, qt_TexCoord + direction * offsets.w) * weights.w; \n" + + " sum += texture2D(_source, qt_TexCoord0 - direction * offsets.x) * weights.x; \n" + + " sum += texture2D(_source, qt_TexCoord0 - direction * offsets.y) * weights.y; \n" + + " sum += texture2D(_source, qt_TexCoord0 - direction * offsets.z) * weights.z; \n" + + " sum += texture2D(_source, qt_TexCoord0 - direction * offsets.w) * weights.w; \n" + + " sum += texture2D(_source, qt_TexCoord0 + direction * offsets.x) * weights.x; \n" + + " sum += texture2D(_source, qt_TexCoord0 + direction * offsets.y) * weights.y; \n" + + " sum += texture2D(_source, qt_TexCoord0 + direction * offsets.z) * weights.z; \n" + + " sum += texture2D(_source, qt_TexCoord0 + direction * offsets.w) * weights.w; \n" + " gl_FragColor = qt_Opacity * sum; \n" + "}" fragmentShader: - "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "uniform lowp sampler2D _source; \n" + "uniform lowp sampler2D source; \n" + "uniform lowp vec4 color; \n" + "uniform lowp float intensity; \n" + "uniform lowp float qt_Opacity; \n" + "void main() { \n" + - " lowp vec4 pix = texture2D(source, qt_TexCoord); \n" + - " lowp vec4 glow = texture2D(_source, qt_TexCoord); \n" + + " lowp vec4 pix = texture2D(source, qt_TexCoord0); \n" + + " lowp vec4 glow = texture2D(_source, qt_TexCoord0); \n" + " lowp float gray = dot(glow.xyz, vec3(intensity)); \n" + " gl_FragColor = qt_Opacity * vec4(pix.xyz + color.xyz * gray, pix.w); \n" + "}" @@ -712,7 +753,7 @@ Rectangle { property real intensity fragmentShader: - "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord0; \n" + "uniform lowp sampler2D source; \n" + "uniform lowp vec4 color; \n" + "uniform lowp float intensity; \n" + @@ -720,7 +761,7 @@ Rectangle { "highp float minc(lowp vec3 v) { return min(v.x, min(v.y, v.z)); } \n" + "highp float maxc(lowp vec3 v) { return max(v.x, max(v.y, v.z)); } \n" + "void main() { \n" + - " lowp vec4 pix = texture2D(source, qt_TexCoord); \n" + + " lowp vec4 pix = texture2D(source, qt_TexCoord0); \n" + " highp float lo = minc(pix.xyz); \n" + " highp float hi = maxc(pix.xyz); \n" + " gl_FragColor = qt_Opacity * vec4(mix(pix.xyz, color.xyz * (hi - lo) + lo, intensity), pix.w); \n" + diff --git a/tests/opacityeffect.qml b/tests/opacityeffect.qml index 77d6af9..2b52fa6 100644 --- a/tests/opacityeffect.qml +++ b/tests/opacityeffect.qml @@ -87,11 +87,11 @@ Rectangle { id: effect anchors.fill: parent - fragmentShader: "varying highp vec2 qt_TexCoord; \n" + + fragmentShader: "varying highp vec2 qt_TexCoord0; \n" + "uniform sampler2D source; \n" + "uniform highp float qt_Opacity; \n" + "void main() { \n" + - " gl_FragColor = texture2D(source, qt_TexCoord) * qt_Opacity; \n" + + " gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity; \n" + "}" //property url source: "face-smile.png" |