Created
May 8, 2018 14:38
-
-
Save GunnarKarlsson/06d64597b52f2dabe988a61fe80b6c4c to your computer and use it in GitHub Desktop.
Fragment shader: square follows mouse
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
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
{ | |
vec3 col1 = vec3(0.5, 0.5, 0.5); | |
vec3 col2 = vec3(0.0, 1.0, 1.0); | |
vec3 col = col1; | |
if (fragCoord.x > iMouse.x - 30.0 && | |
fragCoord.x < iMouse.x + 30.0 && | |
fragCoord.y > iMouse.y - 30.0 && | |
fragCoord.y < iMouse.y + 30.0) { | |
col = col2; | |
} | |
fragColor = vec4(col,1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment