Created
October 5, 2020 03:45
-
-
Save Macorreag/9368c56b64292bc346fb511d061e9382 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Pattern 1: Data sent from the sketch to the shaders | |
uniform sampler2D texture; | |
// Patter 2: Passing data among shaders | |
varying vec4 vertColor; | |
varying vec4 vertTexCoord; | |
const vec4 lumcoeff = vec4(0.299, 0.587, 0.114, 0); | |
void main() { | |
// Pattern 3: Consistency of space transformations | |
vec4 col = texture2D(texture, vertTexCoord.st); | |
float lum = dot(col, lumcoeff); | |
gl_FragColor = vec4(lum, lum, lum, 1.0) * vertColor; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment