Standard disclaimer: This is not copy-n-paste. This was all written from memory and then corrected as necessary using the relevant references.

Standard(s): OpenGL (introduced in 1.0)
Language(s): C (this function is also supported by all interfaces from other languages)
Header File: "GL/gl.h"
See also: glBegin, OpenGL rendering pipeline.

void glEnd()


This function should be called after a corresponding glBegin call. It tells OpenGL that your program is finished providing the data the current glBegin call was made to begin.


All examples are in C++, and are just examples of usage, they're not guaranteed to do anything useful.

The following example is a correct use of this function.

  glVertex3f(1.5f, 1.4f, 1.2f);
  glVertex3f(1.5f, -1.2f, 1.2f);
  glVertex3f(1.5f, -1.2f, 2.5f);
  glVertex3f(1.5f, 1.4f, 2.5f);

The following example is an invalid use of this function, which will result in a GL_INVALID_OPERATION error (see below).

 glVertex3f(0.0f, 1.0f, 0.0f);
 glEnd(); // this is incorrect; missing glBegin

For more examples, see glBegin and/or OpenGL rendering pipeline.

Possible Errors

Please see OpenGL error handling for an explanation of what this means.

GL_INVALID_OPERATION is generated if you call this function without having called glBegin first, or if not having called glBegin again since the last glEnd call.

part of the codenode project; edited by: insanefuzzie

Log in or register to write something here or to contact authors.