summaryrefslogtreecommitdiffhomepage
path: root/examples/resources/shaders/shapes_grayscale.fs
blob: 1b778871780a6a0744c10275f4c326f999a48089 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#version 110

uniform sampler2D texture0;
varying vec2 fragTexCoord;
varying vec4 fragColor;

void main()
{
    vec4 base = texture2D(texture0, fragTexCoord)*fragColor;

    // Convert to grayscale using NTSC conversion weights
    float gray = dot(base.rgb, vec3(0.299, 0.587, 0.114));
    
    gl_FragColor = vec4(gray, gray, gray, base.a);
}