In the first part of the Shapes snippets, I will show you how to draw the easiest of the rather complex shapes. The famous, well-known circle. If you still remember what you learned in your trigonometry lessons, you should know that the the x-coordinate of a point on the unit circle - a circle whose radius is 1 - is cos § where § is the angle from the center of the circle to the point. The y-coordinate is sin §.
This makes drawing a circle absolutely easy. Here's the code:
That's all! In this function we will iterate through 0-359° and draw for every angle the corresdonding point on the circle, using cos(..) and sin(..). Don't forget to convert degrees into radians as C/C++ trigonometry functions expect the angle to be in radians. You could also use a bigger or smaller range (e.g. 0-359 with steps of 0.1 ) if you want a higher/lower resolution of the circle.
We use GL_LINE_LOOP as we want to draw lines from one point to the other and we want the circle to be closed. If you would like the circle to be made of points, simply use GL_LINES. Little example how to use the function: