1GLBEGIN(3G)                                                        GLBEGIN(3G)
2
3
4

NAME

6       glBegin, glEnd - delimit the vertices of a primitive or a group of like
7       primitives
8
9

C SPECIFICATION

11       void glBegin( GLenum mode )
12
13

PARAMETERS

15       mode  Specifies the primitive or primitives that will be  created  from
16             vertices presented between glBegin and the subsequent glEnd.  Ten
17             symbolic   constants   are   accepted:    GL_POINTS,    GL_LINES,
18             GL_LINE_STRIP,   GL_LINE_LOOP,  GL_TRIANGLES,  GL_TRIANGLE_STRIP,
19             GL_TRIANGLE_FAN, GL_QUADS, GL_QUAD_STRIP, and GL_POLYGON.
20

C SPECIFICATION

22       void glEnd( void )
23
24

DESCRIPTION

26       glBegin and glEnd delimit the vertices that define  a  primitive  or  a
27       group of like primitives.  glBegin accepts a single argument that spec‐
28       ifies in which of ten ways the vertices are interpreted.  Taking  n  as
29       an integer count starting at one, and N as the total number of vertices
30       specified, the interpretations are as follows:
31
32       GL_POINTS              Treats each vertex as a single point.  Vertex  n
33                              defines point n.  N points are drawn.
34
35       GL_LINES               Treats  each  pair of vertices as an independent
36                              line segment.  Vertices 2n−1 and 2n define  line
37                              n.  N/2 lines are drawn.
38
39       GL_LINE_STRIP          Draws  a  connected  group of line segments from
40                              the first vertex to the last.   Vertices  n  and
41                              n+1 define line n.  N−1 lines are drawn.
42
43       GL_LINE_LOOP           Draws  a  connected  group of line segments from
44                              the first vertex to the last, then back  to  the
45                              first.   Vertices  n and n+1 define line n.  The
46                              last line, however, is defined by vertices N and
47                              1.  N lines are drawn.
48
49       GL_TRIANGLES           Treats  each  triplet of vertices as an indepen‐
50                              dent triangle.   Vertices  3n−2,  3n−1,  and  3n
51                              define triangle n.  N/3 triangles are drawn.
52
53       GL_TRIANGLE_STRIP      Draws  a connected group of triangles.  One tri‐
54                              angle is defined for each vertex presented after
55                              the  first two vertices.  For odd n, vertices n,
56                              n+1, and n+2 define triangle  n.   For  even  n,
57                              vertices n+1, n, and n+2 define triangle n.  N−2
58                              triangles are drawn.
59
60       GL_TRIANGLE_FAN        Draws a connected group of triangles.  One  tri‐
61                              angle is defined for each vertex presented after
62                              the first two vertices.  Vertices  1,  n+1,  and
63                              n+2 define triangle n.  N−2 triangles are drawn.
64
65       GL_QUADS               Treats  each  group of four vertices as an inde‐
66                              pendent  quadrilateral.   Vertices  4n−3,  4n−2,
67                              4n−1,   and  4n  define  quadrilateral  n.   N/4
68                              quadrilaterals are drawn.
69
70       GL_QUAD_STRIP          Draws a connected group of quadrilaterals.   One
71                              quadrilateral  is  defined for each pair of ver‐
72                              tices presented after the first pair.   Vertices
73                              2n−1, 2n, 2n+2, and 2n+1 define quadrilateral n.
74                              N/2−1 quadrilaterals are drawn.  Note  that  the
75                              order  in which vertices are used to construct a
76                              quadrilateral from strip data is different  from
77                              that used with independent data.
78
79       GL_POLYGON             Draws  a  single,  convex  polygon.   Vertices 1
80                              through N define this polygon.
81
82       Only a subset of GL commands can be used  between  glBegin  and  glEnd.
83       The  commands  are  glVertex,  glColor,  glIndex, glNormal, glTexCoord,
84       glEvalCoord, glEvalPoint, glArrayElement, glMaterial,  and  glEdgeFlag.
85       Also, it is acceptable to use glCallList or glCallLists to execute dis‐
86       play lists that include only the preceding commands.  If any  other  GL
87       command  is  executed  between glBegin and glEnd, the error flag is set
88       and the command is ignored.
89
90       Regardless of the value chosen for mode, there is no limit to the  num‐
91       ber  of vertices that can be defined between glBegin and glEnd.  Lines,
92       triangles, quadrilaterals, and polygons that are incompletely specified
93       are  not  drawn.   Incomplete specification results when either too few
94       vertices are provided to specify even a single  primitive  or  when  an
95       incorrect  multiple  of vertices is specified. The incomplete primitive
96       is ignored; the rest are drawn.
97
98       The minimum specification of vertices for each primitive is as follows:
99       1  for  a point, 2 for a line, 3 for a triangle, 4 for a quadrilateral,
100       and 3 for a polygon.  Modes that require a certain multiple of vertices
101       are  GL_LINES  (2),  GL_TRIANGLES  (3), GL_QUADS (4), and GL_QUAD_STRIP
102       (2).
103

ERRORS

105       GL_INVALID_ENUM is generated if mode is set to an unaccepted value.
106
107       GL_INVALID_OPERATION is generated if  glBegin  is  executed  between  a
108       glBegin and the corresponding execution of glEnd.
109
110       GL_INVALID_OPERATION  is  generated  if glEnd is executed without being
111       preceded by a glBegin.
112
113       GL_INVALID_OPERATION is generated if a  command  other  than  glVertex,
114       glColor,   glIndex,  glNormal,  glTexCoord,  glEvalCoord,  glEvalPoint,
115       glArrayElement, glMaterial, glEdgeFlag, glCallList, or  glCallLists  is
116       executed  between the execution of glBegin and the corresponding execu‐
117       tion glEnd.
118
119       Execution      of      glEnableClientState,       glDisableClientState,
120       glEdgeFlagPointer,  glTexCoordPointer,  glColorPointer, glIndexPointer,
121       glNormalPointer,
122       glVertexPointer, glInterleavedArrays, or glPixelStore  is  not  allowed
123       after a call to glBegin and before the corresponding call to glEnd, but
124       an error may or may not be generated.
125

SEE ALSO

127       glArrayElement(3G),   glCallList(3G),   glCallLists(3G),   glColor(3G),
128       glEdgeFlag(3G), glEvalCoord(3G),
129       glEvalPoint(3G),     glIndex(3G),     glMaterial(3G),     glNormal(3G),
130       glTexCoord(3G), glVertex(3G)
131
132
133
134
135
136                                                                   GLBEGIN(3G)
Impressum