postprocess_grayscale.frag 330 B

1234567891011121314151617
  1. #ifdef OPENGL_ES
  2. precision highp float;
  3. #endif
  4. // Uniforms
  5. uniform sampler2D u_texture;
  6. // Inputs
  7. varying vec2 v_texCoord;
  8. void main()
  9. {
  10. // Sample the diffuse texture for base color
  11. float gray = dot(texture2D(u_texture, v_texCoord).rgb, vec3(0.299, 0.587, 0.114));
  12. gl_FragColor = vec4(gray, gray, gray, 1.0);
  13. }