jmasterx
jmasterx

Reputation: 54113

Most efficient way to draw circles for polygon outlines

I'm using OpenGL and was told I should draw circles at each vertex of my outline to get smoothness. I tried this and it works great. The problem is speed. It crippled my application to draw a circle at each vertex. I'm not sure how else to fix the anomaly of my outlines other than circles, but using display lists and trying with vertex array both were brutally slow. Thanks

see: Edges on polygon outlines not always correct

Upvotes: 2

Views: 2424

Answers (2)

Carlos Scheidegger
Carlos Scheidegger

Reputation: 1966

One (perhaps too fancy) alternative is to draw a single polygon that bounds the circle (say, a quad), and then use a fragment program to discard the fragments. This would not be entirely trivial to write, but I would bet it's the fastest way.

You would simply pass the circle parameters to the fragment program and discard the fragment if the distance from the fragment center to the center of the circle is bigger than the desired radius.

Upvotes: 2

Jon Cage
Jon Cage

Reputation: 37458

Have you seen this article?

..or if you have access to the GL utility library, you could use gluDisk

Upvotes: 0

Related Questions