Export (0) Print
Expand All

glRecti function

Applies to: desktop apps only

The glRecti function draws a rectangle.

Syntax

void WINAPI glRecti(
  GLint x1,
  GLint y1,
  GLint x2,
  GLint y2
);

Parameters

x1

The x coordinate of the vertex of a rectangle.

y1

The y coordinate of the vertex of a rectangle.

x2

The x coordinate of the opposite vertex of the rectangle.

y2

The y coordinate of the opposite vertex of the rectangle.

Return value

This function does not return a value.

Error codes

The following error code can be retrieved by the glGetError function.

NameMeaning
GL_INVALID_OPERATION

The function was called between a call to glBegin and the corresponding call to glEnd.

Remarks

The glRecti function supports efficient specification of rectangles as two corner points. Each rectangle command takes four arguments, organized either as two consecutive pairs of (xy) coordinates, or as two pointers to arrays, each containing an (xy) pair. The resulting rectangle is defined in the z = 0 plane.

The glRecti(x1, y1, x2, y2) function is exactly equivalent to the following sequence:

glBegin(GL_POLYGON);

glVertex2( x1, y1 );

glVertex2( x2, y1 );

glVertex2( x2, y2 );

glVertex2( x1, y2 );

glEnd( );

Notice that if the second vertex is above and to the right of the first vertex, the rectangle is constructed with a counterclockwise winding.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Gl.h

Library

Opengl32.lib

DLL

Opengl32.dll

See also

glBegin
glEnd
glVertex

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show:
© 2014 Microsoft