Draw disks using only radius and center points

I need to draw multiple filled disks.
I have the radius value and center points for every disk.

If I provide center to vertex shader, then fragment shader only receives that point and cannot draw beyond single point.
If I provide more that one center that creates a shape filling the disk, like a square around the disk or equilateral triangle around the disk, I have to provide at least 3 vertices (Even if I use index buffers). This creates much more data that required.

Is there any more efficient way to draw disks. Or can I output more vertices from vertex shader to fragment shader, in order to increase the scope of fragment shader?

There are a variety of options. You can use instancing to create multiple instances of a series of primitives, or you can use a geometry shader to output multiple triangles for each vertex.

As for rendering the individual discs, you can either approximate them with a many-sided polygon, or you can draw something with fewer sides and use the fragment shader to discard fragments which are more than a given distance from the centre.

1 Like

Thanks for reply
Both of them are useful in my case.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.