// Flush drawing commands
ONE THING AT A TIME
Again, don’t get too distracted by the functions in this example that we haven’t covered yet (glPushMatrix, glPopMatrix, and glRotate). These functions are used to rotate the image around so you can better see the positioning of the points as they are drawn in 3D space. We cover these functions in some detail in Chapter 4. If we hadn’t used these features now, you wouldn’t be able to see the effects of your 3D drawings, and this and the following sample programs wouldn’t be very interesting to look at. For the rest of the sample code in this chapter, we show only the code that includes the glBegin and glEnd statements.
The figure in this box shows a circle drawn in the xy plane. A line segment from the origin (0,0) to any point on the circle makes an angle (a) with the x-axis. For any given angle, the trigono-metric functions sine and cosine return the x and y values of the point on the circle. By stepping a variable that represents the angle all the way around the origin, we can calculate all the points on the circle. Note that the C runtime functions sin() and cos() accept angle values measured in radians instead of degrees. There are 2*PI radians in a circle, where PI is a nonrational number that is approximately 3.1415. (Nonrational means it is a repeating decimal number that cannot be represented as a fraction.)
GLfloat sizes; // Store supported point size range
GLfloat step; // Store supported point size increments