# OpenGL Programming/reference/glBegin

From Wikibooks, open books for an open world

## Contents

## Description[edit]

- Defines a list of points to make in to primitives.
- The type of primitive is passed when you call it.

## Useage Context[edit]

### Allowed Primitive Types[edit]

- [[OpenGL_Programming/reference/L_POINTS
- Each vertex is a single point

- [[OpenGL_Programming/reference/GL_LINES
- Must be a multiple of 2
- Each pair of vertices is a independent line segment.

- [[OpenGL_Programming/reference/GL_LINE_STRIP
- Draws a connected group of line segments from the first vertex to the last. After the first Vertices each additonal Vertices draws a new line.

- [[OpenGL_Programming/reference/GL_LINE_LOOP
- Draws a connected group of line segments from the first vertex to the last. The last line is defined by the first and last vertex makeing a closed loop.

- [[OpenGL_Programming/reference/GL_TRIANGLES
- Each triplet of vertices as an independent triangle.
- Must be a multiple of 3

- [[OpenGL_Programming/reference/GL_TRIANGLE_STRIP
- Draws a connected group of triangles. After the first 2 vertices each additonal point defines a new triangle. The triangle is made up of the last 2 and the newist vertex moving down the list.

- [[OpenGL_Programming/reference/GL_TRIANGLE_FAN
- Draws a connected group of triangles. After the first 2 vertices each additonal point defines a new triangle. The triangle is made up of the first the last and the newist vertex moving down the list.

- [[OpenGL_Programming/reference/GL_QUADS
- Each group of four vertices as an independent quadriliteral.
- Must be a multiple of 4

- [[OpenGL_Programming/reference/GL_QUAD_STRIP
- Draws a connected group of quadriliterals. After the first 2 Vertices each additonal pair Vertices makes a new quadriliteral.
- Must be a multiple of 2 after the first 2 Vertices.

- [[OpenGL_Programming/reference/GL_POLYGON
- Draws a single polygon. same as GL_LINE_STRIP
- Must have 3 or more Vertices.

### Functions allowed inside a glBegin glEnd section[edit]

- glVertex
- glColor
- glIndex
- glNormal
- glTexCoord
- glEvalCoord
- glEvalPoint
- glMaterial
- glEdgeFlag
- glCallList
- glCallLists