Rect
The Rect function supports efficient specification of rectangles as two corner points. Each rectangle command takes four arguments, organized as two consecutive pairs of (x, y) coordinates. The resulting rectangle is defined in the z = 0 plane.
Rect( x1, y1, x2, y2 );
The Rect(x1, y1, x2, y2) function is exactly equivalent to the following sequence:
Begin(GL_POLYGON);
Vertex2(x1, y1);
Vertex2(x2, y1);
Vertex2(x2, y2);
Vertex2(x1, y2);
End( );
Arguments
x1, y1
One vertex of a rectangle.
x2, y2
The opposite vertex of the rectangle.
Notice that if the second vertex is above and to the right of the first vertex, the rectangle is constructed with a counterclockwise winding.
Note: Do not call Rect between a call to Begin and the corresponding call to End.
See Also