shapes_grayscale.fs 344 B

123456789101112131415
  1. #version 110
  2. uniform sampler2D texture0;
  3. varying vec2 fragTexCoord;
  4. varying vec4 fragColor;
  5. void main()
  6. {
  7. vec4 base = texture2D(texture0, fragTexCoord)*fragColor;
  8. // Convert to grayscale using NTSC conversion weights
  9. float gray = dot(base.rgb, vec3(0.299, 0.587, 0.114));
  10. gl_FragColor = vec4(gray, gray, gray, base.a);
  11. }