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 along with the GL_LINE_LOOP keyword.
- Use a for loop to draw small lines from 0 to 360 to give the shape of a circle.
The program for drawing a circle is as follows:
//opengldrawshapes2.c#include <GL/glut.h> #include<math.h> #define pi 3.142857 void drawshapes() { glClearColor(0.0f, ...