summaryrefslogtreecommitdiffstats
path: root/examples/shadereffectitem/Effectoids/Box4PointBlur.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/shadereffectitem/Effectoids/Box4PointBlur.qml')
-rw-r--r--examples/shadereffectitem/Effectoids/Box4PointBlur.qml53
1 files changed, 29 insertions, 24 deletions
diff --git a/examples/shadereffectitem/Effectoids/Box4PointBlur.qml b/examples/shadereffectitem/Effectoids/Box4PointBlur.qml
index f64fbe7..64cd727 100644
--- a/examples/shadereffectitem/Effectoids/Box4PointBlur.qml
+++ b/examples/shadereffectitem/Effectoids/Box4PointBlur.qml
@@ -48,39 +48,44 @@ ShaderEffectItem
"varying highp vec2 my_TexCoord2; \n" +
"varying highp vec2 my_TexCoord3; \n" +
"varying highp vec2 my_TexCoord4; \n" +
- "uniform sampler2D source; \n" +
+ "uniform lowp sampler2D source; \n" +
+ "uniform highp float qt_Opacity; \n" +
"void main() { \n" +
- " gl_FragColor = (texture2D(source, qt_TexCoord) \n" +
- " + texture2D(source, my_TexCoord2) \n" +
- " + texture2D(source, my_TexCoord3) \n" +
- " + texture2D(source, my_TexCoord4)) * 0.25; \n" +
+ " gl_FragColor = qt_Opacity * (texture2D(source, qt_TexCoord) \n" +
+ " + texture2D(source, my_TexCoord2) \n" +
+ " + texture2D(source, my_TexCoord3) \n" +
+ " + texture2D(source, my_TexCoord4)) * 0.25; \n" +
"}"
vertexShader:
- "attribute highp vec4 qt_VertexPosition; \n" +
- "attribute highp vec2 qt_VertexTexCoord; \n" +
- "uniform highp mat4 qt_Matrix; \n" +
- "uniform highp float xOffset; \n" +
- "uniform highp float yOffset; \n" +
- "varying highp vec2 qt_TexCoord; \n" +
- "varying highp vec2 my_TexCoord2; \n" +
- "varying highp vec2 my_TexCoord3; \n" +
- "varying highp vec2 my_TexCoord4; \n" +
- "void main() { \n" +
- " highp vec2 s1 = vec2(xOffset, yOffset); \n" +
- " highp vec2 s2 = vec2(-xOffset, yOffset); \n" +
- " qt_TexCoord = qt_VertexTexCoord + s1; \n" +
- " my_TexCoord2 = qt_VertexTexCoord - s1; \n" +
- " my_TexCoord3 = qt_VertexTexCoord + s2; \n" +
- " my_TexCoord4 = qt_VertexTexCoord - s2; \n" +
- " gl_Position = qt_Matrix * qt_VertexPosition; \n" +
+ "attribute highp vec4 qt_Vertex; \n" +
+ "attribute highp vec2 qt_MultiTexCoord0; \n" +
+ "uniform highp mat4 qt_Matrix; \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 my_TexCoord2; \n" +
+ "varying highp vec2 my_TexCoord3; \n" +
+ "varying highp vec2 my_TexCoord4; \n" +
+ "void main() { \n" +
+ " highp vec2 s1 = vec2(xOffset, yOffset); \n" +
+ " highp vec2 s2 = vec2(-xOffset, yOffset); \n" +
+ " highp vec2 tcoord = mix(_normMargins, \n" +
+ " qt_MultiTexCoord0 - _normMargins, qt_MultiTexCoord0); \n" +
+ " qt_TexCoord = 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" +
"}"
property variant source;
property real xOffset: 0.5 / width
property real yOffset: 0.5 / height
+ property variant _normMargins: Qt.size(margins.width / (2 * margins.width + width), margins.height / (2 * margins.height + height))
+ property variant margins: "margins" in source ? source.margins : Qt.size(0, 0)
active: true
blending: true
- smooth: true
-
+ property variant source
}