Example Program: box.cc

You will notice that five vertices are listed and that the last one is the same as the first. We need to do this to draw a closed square.

As in the case of glColor4fv(), the suffix of the glVertex2f() function indicates that there are two parameters and that they are both floats.

Finally, this code block ends with glEnd() which signals that the primitive, in this case a square, is compete.