Last active
March 8, 2023 23:41
-
-
Save grazer/6774782 to your computer and use it in GitHub Desktop.
red circle GLSL fragment shader
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
void main(void) { | |
// the center of the texture | |
vec2 center = vec2(iResolution.x/2.0,iResolution.y/2.0); | |
// current pixel location | |
vec2 loc = gl_FragCoord.xy; | |
// how far we are from the center | |
float radius=length(loc-center); | |
// if we are within our circle, paint it red | |
if (radius<100.0) | |
gl_FragColor = vec4(1,0,0,1); // red | |
else | |
gl_FragColor = vec4(0,0,0,1); // black | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment