I use the language Rust and the Glium library. I want to display a large number of circles on the screen, but I can not decide how I'd better do it.
There is an option to create circles from triangles, or I can draw them with a fragment shader, that is, take the distance from the center of each circle to each point on the screen and if it is less than the radius, then paint it in the desired color. For clarity, here is an example of how I draw one circle:
vec2 point = vec2(200.0f, 200.0f);
float dist = distance(point, gl_FragCoord.xy);
if (dist < 200)
gl_FragColor = vec4(0.0f, 1.0f, 0.0f, 1.0f);
Which method will work faster? Are there options to do it better? The size and color of each circle will change in the run-time.