Created
November 18, 2018 06:48
-
-
Save DBC-Works/aeb3366fc8a32aeffc2f6ce1e9d7a01a to your computer and use it in GitHub Desktop.
Grayscale translater fragment shader for Processing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uniform sampler2D texture; | |
uniform ivec2 u_size; | |
out vec4 o_fragColor; | |
void main() | |
{ | |
vec4 color = texture(texture, gl_FragCoord.xy / u_size); | |
float grayScale = ((color.r * 0.109375) + (color.g * 0.30078125) + (color.b * 0.58984375)); | |
o_fragColor = vec4(grayScale, grayScale, grayScale, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment