![]() But that is a lot of work, and there is a better way: define a square whose sides are equal to the diameter of the circle you want to draw and have the fragment shader determine whether the point it is drawing is inside or outside the circle. ![]() Triangles of course have straight sides, but the more triangles you use to define the circle, and therefore the closer the vertices on the edge of the circle are, the closer they represent a rounded edge. The only shapes that OpenGL can draw are points, lines, and triangles,so how do you draw circles and other shapes? A reasonable approximation of a circle can be drawn using many, many triangles with one vertex at the centre of the circle and the other two vertices sharing the same location as one of the vertices of the triangles next to it on the outer edge of the circle. ![]() See Related Articles, at the bottom of this article, for the full list. This article builds on code and information that was provided in a number of other articles on this site.
0 Comments
Leave a Reply. |