How it works...
The first step, as expected, is that GLUT is initialized, followed by creating a top-level window, and the label supplied for the window is Drawing some shapes. However, you can give it any label. The window is defined with a width of 1,500 px and height of 1,500 px. The initial position of the window is set at 0,0, that is, at the coordinates of x=0 and y=0. The drawshapes callback function is invoked for displaying different shapes in the window.
In the drawshapes function, the values of the color buffers are cleared, followed by clearing the buffers to preset values.
The first shape that we are drawing is a square, so a group of statements for drawing a square are enclosed within glBegin and glEnd statements. The GL_QUADS ...
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