summaryrefslogtreecommitdiff
path: root/src/effects/shaders/+glslcore/desaturate.frag
blob: c95c0a5185350db897e07730c1c9b38499f2b2c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
#version 150 core
in vec2 qt_TexCoord0;
uniform float qt_Opacity;
uniform sampler2D source;
uniform float desaturation;
out vec4 fragColor;
void main(void) {
    vec4 textureColor = texture(source, qt_TexCoord0.st);
    float grayColor = (textureColor.r + textureColor.g + textureColor.b) / 3.0;
    fragColor = mix(textureColor, vec4(vec3(grayColor), textureColor.a), desaturation) * qt_Opacity;
}