diff options
-rw-r--r-- | data/ellipse.frag | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/data/ellipse.frag b/data/ellipse.frag index bf35027..2436f28 100644 --- a/data/ellipse.frag +++ b/data/ellipse.frag @@ -4,5 +4,12 @@ uniform mat2 m = mat2(1.); void main() { - gl_FragColor = vec4(1.0); + vec2 cartesian_PointCoord = m * ((gl_PointCoord * -2.0) + vec2(1.0)); + vec2 len_sq = cartesian_PointCoord * cartesian_PointCoord; + len_sq.y /= 2.0; + if (len_sq.x + len_sq.y < 0.5) { + gl_FragColor = vec4(1.0); + } else { + discard; + } } |