summaryrefslogtreecommitdiff
path: root/src/effects/shaders/desaturate.frag
blob: c6491cad8ffdb5fcbee2c7bba262fb25e3307005 (plain)
1
2
3
4
5
6
7
8
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;
}