aboutsummaryrefslogtreecommitdiffstats
path: root/src/effects/shaders/desaturate.frag
diff options
context:
space:
mode:
Diffstat (limited to 'src/effects/shaders/desaturate.frag')
-rw-r--r--src/effects/shaders/desaturate.frag9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/effects/shaders/desaturate.frag b/src/effects/shaders/desaturate.frag
new file mode 100644
index 0000000..c6491ca
--- /dev/null
+++ b/src/effects/shaders/desaturate.frag
@@ -0,0 +1,9 @@
+varying highp vec2 qt_TexCoord0;
+uniform highp float qt_Opacity;
+uniform lowp sampler2D source;
+uniform highp float desaturation;
+void main(void) {
+ lowp vec4 textureColor = texture2D(source, qt_TexCoord0.st);
+ lowp float grayColor = (textureColor.r + textureColor.g + textureColor.b) / 3.0;
+ gl_FragColor = mix(textureColor, vec4(vec3(grayColor), textureColor.a), desaturation) * qt_Opacity;
+}