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: glFlush, OpenGL rendering pipeline.

void glFinish()


This function waits (blocks) until all previously-called OpenGL commands, such as state changes, rendering and changes to connection state, have been completed. It is not recommended for use unless you really require it; try to use glFlush instead, which doesn't block.


Typical usage would just be a simple call after state changes and rendering, as follows.

 do_state_changes(); // program-defined function
 do_rendering(); // program-defined function

For complete examples, see 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 inside a glBegin/glEnd block (ie, you have called glBegin but haven't called glEnd since).

part of the codenode project; edited by: insanefuzzie