Created
May 27, 2012 10:13
-
-
Save Madsy/2803178 to your computer and use it in GitHub Desktop.
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
#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