Circles (GL points) anti-aliasing #268
This commit is contained in:
parent
c1a5ad7e74
commit
19109516ae
@ -11,6 +11,9 @@ void main() {
|
|||||||
|
|
||||||
$$
|
$$
|
||||||
|
|
||||||
|
#ifdef GL_OES_standard_derivatives
|
||||||
|
#extension GL_OES_standard_derivatives : enable
|
||||||
|
#endif
|
||||||
#ifdef GLES
|
#ifdef GLES
|
||||||
precision highp float;
|
precision highp float;
|
||||||
#endif
|
#endif
|
||||||
@ -18,6 +21,7 @@ uniform vec4 u_color;
|
|||||||
void main() {
|
void main() {
|
||||||
vec2 cxy = 2.0 * gl_PointCoord - 1.0;
|
vec2 cxy = 2.0 * gl_PointCoord - 1.0;
|
||||||
float r = dot(cxy, cxy);
|
float r = dot(cxy, cxy);
|
||||||
float len = 1.0 - length(r);
|
float delta = fwidth(r);
|
||||||
gl_FragColor = u_color * len;
|
float alpha = 1.0 - smoothstep(1.0 - delta, 1.0 + delta, r);
|
||||||
|
gl_FragColor = u_color * alpha;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user