Example Program: box.cc

The last code block in this function also draws a square using a line loop, but this time uses the data structure defined at the beginning of the function. Notice that this time glVertex2fv() is used since its parameters are two-element vectors.

    glColor4fv( blue );
    glBegin( GL_LINE_LOOP );
    for ( i = 0; i < 4; i++ )
    {
        glVertex2fv( p[i] );
    }
    glEnd();