Skip to content

Instantly share code, notes, and snippets.

@GunnarKarlsson
Last active September 12, 2018 01:32
Show Gist options
  • Save GunnarKarlsson/19cb813fe8ff0ad241c5be5fa4e89494 to your computer and use it in GitHub Desktop.
Save GunnarKarlsson/19cb813fe8ff0ad241c5be5fa4e89494 to your computer and use it in GitHub Desktop.
Frag shader: circle follows mouse
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec3 col = vec3(0.5, 0.5, 0.5);
float radius = 50.0;
float dist_squared = dot(iMouse.xy - fragCoord.xy, iMouse.xy - fragCoord.xy);
if (dist_squared < (radius * radius)) {
col += vec3(0.0, 1.0, 1.0);
}
fragColor = vec4(col,1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment