Why is there no circle or ellipse primitive in OpenGL?

前端 未结 5 2257
执念已碎
执念已碎 2021-02-12 16:50

Circles are one of the basics geometric entities. Yet there is no primitives defined in OpenGL for this, like lines or polygons. Why so? It\'s a little annoying to include custo

5条回答
  •  太阳男子
    2021-02-12 17:22

    Because graphic cards operate on 3-dimensional points, lines and triangles. A circle requires curves or splines. It cannot be perfectly represented by a "normal" 3D primitive, only approximated as an N-gon (so it will look like a circle at a certain distance). If you want a circle, write the routine yourself (it isn't hard to do). Either draw it as an N-gon, or make a square (2 triangles) and cut a circle out of it it using fragment shader (you can get a perfect circle this way).

提交回复
热议问题