Created
September 11, 2013 07:29
-
-
Save Sachs27/6520344 to your computer and use it in GitHub Desktop.
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
#version 330 core | |
layout(location = 0) out vec4 fcolor; | |
void main(void) { | |
const vec4 color1 = vec4(0.0, 0.6, 0.0, 1.0); | |
const vec4 color2 = vec4(0.9, 0.7, 1.0, 0.0); | |
if (gl_PointCoord == vec2(1.0)) { | |
fcolor = vec4(1.0f, 0.0f, 0.0f, 1.0f); | |
return; | |
} | |
/* centers gl_PointCoord around the origin */ | |
vec2 t = gl_PointCoord - vec2(0.5); | |
float f = dot(t, t); | |
if (f > 0.25) { | |
discard; | |
} | |
fcolor = mix(color1, color2, smoothstep(0.1, 0.25, f)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment