Name
gl.Rect -- draw a rectangle
Synopsis
gl.Rect(x1, y1, x2, y2)
Function
gl.Rect() supports efficient specification of rectangles as two corner points. Each rectangle command takes four arguments, organized as two consecutive pairs of (x,y) coordinates. Alternatively, you can also pass two tables containing (x,y) coordinates each to gl.Rect(). The resulting rectangle is defined in the z = 0 plane.

gl.Rect(x1, y1, x2, y2) is exactly equivalent to the following sequence:

 
gl.Begin(#GL_POLYGON)
gl.Vertex(x1, y1)
gl.Vertex(x2, y1)
gl.Vertex(x2, y2)
gl.Vertex(x1, y2)
gl.End()

Note that if the second vertex is above and to the right of the first vertex, the rectangle is constructed with a counter-clockwise winding.

Please consult an OpenGL reference manual for more information.

Inputs
x1
specifies one vertex of the rectangle
y1
specifies one vertex of the rectangle
x2
specifies the opposite vertex of the rectangle
y2
specifies the opposite vertex of the rectangle
Errors
#GL_INVALID_OPERATION is generated if gl.Rect() is executed between the execution of gl.Begin() and the corresponding execution of gl.End().


Show TOC