Skip to content

Commit

Permalink
Step 1 - Drawing a circle
Browse files Browse the repository at this point in the history
  • Loading branch information
PixelsCommander committed Oct 21, 2017
0 parents commit c53f74e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions fragment-shader.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifdef GL_ES
precision mediump float;
#endif

precision highp float;
uniform float u_time;
uniform vec2 u_resolution;
uniform vec2 u_mouse;

float PI = 3.14159;
vec2 center = u_resolution * 0.5;
float radius = min(u_resolution.x, u_resolution.y) * .5;

float circle(vec2 coord, vec2 center, float radius) {
float distanceToCenter = distance(coord, center);
return step(distanceToCenter, radius);
}

void main() {
vec2 coord = vec2(gl_FragCoord);
float isFilled = circle(coord, center, radius);
gl_FragColor = vec4(1. - isFilled);
}

0 comments on commit c53f74e

Please sign in to comment.