How it works...
GLUT is initialized and a top-level window is created with the label, Drawing some shapes. The size of the window is defined as 1,500 px wide and 1,500 px in height. The initial position of the window is set at 0, 0, that is, at the x=0 and y=0 coordinate location. The drawshapes callback function is invoked for drawing a circle in the window.
In the drawshapes function, the values of the color buffers are cleared, followed by clearing the buffers to preset values. The glColor3f function is invoked to set the color in which we want to draw the circle. I have set the color to green to draw the circle but you can choose any color. A group of statements meant for drawing a circle is collected within a pair of glBegin and glEnd ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access