1

I found 6 different ways to draw a basic circle in modern OpenGL (using the Qt framework).

  • the discard statement of the fragment shader
  • the stencil buffer
  • the QPainter
  • the triangle-fan primitve
  • mapping a texture which contains an image of a circle to a quad
  • point sprites

Edit:They are intended to be used as particle like objects in simulation application e.g. game of life, moving organisms ect. also beeing compatible with a colision detection.

  1. I would like to know, which is the 'best' way to draw a circle?
  2. What method has the best performance?
  3. Are there other reasons then performance to choose between those?
  4. Are there even better ways to draw circles given 3.?
Community
  • 1
  • 1
Sharky Bamboozle
  • 1,066
  • 16
  • 28

1 Answers1

1

I would like to know, which is the 'best' way to draw a circle?

That can't be answered in general, it depends on the broader intentions. For example a discard statement circle will always be "perfect" in the sense that down to a pixel level it follows the mathematical definition of a circle.

But it comes at the expense of requiring a fragment shader and increased complexity if you want to transform it other than just translating it.

What method has the best performance?

Again this depends on your overall intentions for what kind of scene the circle is used to be in.

Are there other reasons then performance to choose between those?

Flexibility, support for integration into existing frameworks, etc.

Are there even better ways to draw circles?

Define "better".

datenwolf
  • 159,371
  • 13
  • 185
  • 298