Skip to content

Instantly share code, notes, and snippets.

@Madsy
Created May 27, 2012 10:13
Show Gist options
  • Save Madsy/2803178 to your computer and use it in GitHub Desktop.
Save Madsy/2803178 to your computer and use it in GitHub Desktop.
#version 330
uniform vec3 color;
uniform float radius;
uniform float thickness;
out vec4 outColor;
void main(){
float edge, t;
vec2 tc = gl_FragCoord.xy;
tc.x -= width/2;
tc.y -= height/2;
edge = float(length(tc) - radius);
if(edge < 0)
outColor = vec4(color.rgb, 1.0);
else if(edge > thickness)
outColor = vec4(0);
else { /* 0 < edge < thickness */
t = 1.0 - edge/thickness
outColor = vec4(color.rgb, t);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment