Legacy (immediate mode)GL 1.0

glEnd

Finishes a glBegin block and draws the vertices sent inside it.

Removed from the core profile. Part of the legacy immediate mode, removed from the core profile in OpenGL 3.2. Shown here only so you can recognize it in old tutorials — use VBOs and VAOs instead.

Signature

void glEnd(void);

How it works

Closes the block opened by glBegin; the vertices sent in between are assembled into the primitives glBegin asked for. Inside the block only vertex calls were allowed (glVertex, glColor, glNormal, glTexCoord); anything else was an error. Modern code replaces the whole block with one glDrawArrays over a vertex buffer.

Example

example.cpp
1glBegin(GL_LINES);
2    glVertex3f(0, 0, 0);
3    glVertex3f(1, 1, 0);
4glEnd();