macro stdmacro
GLBEGIN
NAME
"glBegin, glEnd - delimit the vertices of a primitive or a group of like primitives
C SPECIFICATION
void \f3glBegin( GLenum mode )


PARAMETERS

\w'\f2mode 'u \f2mode Specifies the primitive or primitives that will be created from vertices presented between \f3glBegin and the subsequent \f3glEnd. Ten symbolic constants are accepted: \f3GL_POINTS, \f3GL_LINES, \f3GL_LINE_STRIP, \f3GL_LINE_LOOP, \f3GL_TRIANGLES, \f3GL_TRIANGLE_STRIP, \f3GL_TRIANGLE_FAN, \f3GL_QUADS, \f3GL_QUAD_STRIP, and \f3GL_POLYGON.

C SPECIFICATION
void \f3glEnd( void )


DESCRIPTION
\f3glBegin and \f3glEnd delimit the vertices that define a primitive or a group of like primitives. \f3glBegin accepts a single argument that specifies in which of ten ways the vertices are interpreted. Taking \f2n as an integer count starting at one, and \f2N as the total number of vertices specified, the interpretations are as follows:

21 \f3GL_POINTS Treats each vertex as a single point. Vertex \f2n defines point \f2n. \f2N points are drawn.

\f3GL_LINES Treats each pair of vertices as an independent line segment. Vertices \f22n-1 and \f22n define line \f2n\f1. \f2N/2 lines are drawn.

\f3GL_LINE_STRIP Draws a connected group of line segments from the first vertex to the last. Vertices \f2n and \f2n+1 define line \f2n\f1. \f2N-1 lines are drawn.

\f3GL_LINE_LOOP Draws a connected group of line segments from the first vertex to the last, then back to the first. Vertices \f2n and \f2n+1 define line \f2n\f1. The last line, however, is defined by vertices \f2N and \f21. \f2N lines are drawn.

\f3GL_TRIANGLES Treats each triplet of vertices as an independent triangle. Vertices \f23n-2, \f23n-1, and \f23n define triangle \f2n\f1. \f2N/3 triangles are drawn. P

\f3GL_TRIANGLE_STRIP Draws a connected group of triangles. One triangle is defined for each vertex presented after the first two vertices. For odd \f2n, vertices \f2n, \f2n+1, and \f2n+2 define triangle \f2n. For even \f2n, vertices \f2n+1, \f2n, and \f2n+2 define triangle \f2n. \f2N-2 triangles are drawn.

\f3GL_TRIANGLE_FAN Draws a connected group of triangles. One triangle is defined for each vertex presented after the first two vertices. Vertices \f21, \f2n+1, and \f2n+2 define triangle \f2n. \f2N-2 triangles are drawn.

\f3GL_QUADS Treats each group of four vertices as an independent quadrilateral. Vertices \f24n-3, \f24n-2, \f24n-1, and \f24n define quadrilateral \f2n. \f2N/4 quadrilaterals are drawn.

\f3GL_QUAD_STRIP Draws a connected group of quadrilaterals. One quadrilateral is defined for each pair of vertices presented after the first pair. Vertices \f22n-1, \f22n, \f22n+2, and \f22n+1 define quadrilateral \f2n. \f2N/2-1 quadrilaterals are drawn. Note that the order in which vertices are used to construct a quadrilateral from strip data is different from that used with independent data.

\f3GL_POLYGON Draws a single, convex polygon. Vertices \f21 through \f2N define this polygon.

Only a subset of GL commands can be used between \f3glBegin and \f3glEnd. The commands are \f3glVertex, \f3glColor, \f3glIndex, \f3glNormal, \f3glTexCoord, \f3glEvalCoord, \f3glEvalPoint, \f3glArrayElement, \f3glMaterial, and \f3glEdgeFlag. Also, it is acceptable to use \f3glCallList or \f3glCallLists to execute display lists that include only the preceding commands. If any other GL command is executed between \f3glBegin and \f3glEnd, the error flag is set and the command is ignored.

Regardless of the value chosen for \f2mode, there is no limit to the number of vertices that can be defined between \f3glBegin and \f3glEnd. Lines, triangles, quadrilaterals, and polygons that are incompletely specified are not drawn. Incomplete specification results when either too few vertices are provided to specify even a single primitive or when an incorrect multiple of vertices is specified. The incomplete primitive is ignored; the rest are drawn.

The minimum specification of vertices for each primitive is as follows: 1 for a point, 2 for a line, 3 for a triangle, 4 for a quadrilateral, and 3 for a polygon. Modes that require a certain multiple of vertices are \f3GL_LINES (2), \f3GL_TRIANGLES (3), \f3GL_QUADS (4), and \f3GL_QUAD_STRIP (2).

ERRORS
\f3GL_INVALID_ENUM is generated if \f2mode is set to an unaccepted value.

\f3GL_INVALID_OPERATION is generated if \f3glBegin is executed between a \f3glBegin and the corresponding execution of \f3glEnd.

\f3GL_INVALID_OPERATION is generated if \f3glEnd is executed without being preceded by a \f3glBegin.

\f3GL_INVALID_OPERATION is generated if a command other than \f3glVertex, \f3glColor, \f3glIndex, \f3glNormal, \f3glTexCoord, \f3glEvalCoord, \f3glEvalPoint, \f3glArrayElement, \f3glMaterial, \f3glEdgeFlag, \f3glCallList, or \f3glCallLists is executed between the execution of \f3glBegin and the corresponding execution \f3glEnd.

Execution of \f3glEnableClientState, \f3glDisableClientState, \f3glEdgeFlagPointer, \f3glTexCoordPointer, \f3glColorPointer, \f3glIndexPointer, \f3glNormalPointer,

\f3glVertexPointer, \f3glInterleavedArrays, or \f3glPixelStore is not allowed after a call to \f3glBegin and before the corresponding call to \f3glEnd, but an error may or may not be generated.

SEE ALSO
\f3glArrayElement, \f3glCallList, \f3glCallLists, \f3glColor, \f3glEdgeFlag, \f3glEvalCoord,

\f3glEvalPoint, \f3glIndex, \f3glMaterial, \f3glNormal, \f3glTexCoord, \f3glVertex