The procedure for drawing a circle is completely different from the other graphical shapes, hence it gets its own dedicated recipe. It needs a for loop to draw small points or lines at 0 to 360 degrees. So, let's learn to draw a circle.
Drawing a circle
How to do it...
The following are the steps for drawing a circle:
- Initialize GLUT, define the size of a top-level window, and create it. Also, set the initial position of the window for displaying our circle.
- Define a callback function that is auto-invoked after creating the window.
- In the callback function, color buffers are cleared and the color for displaying the circle is set.
- The statements for drawing a circle are grouped within a pair of glBegin and glEnd functions...