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

void glFlush()


This function empties (flushes) any internal OpenGL command buffers (whether in software, hardware or the network layer) to ensure that previously-called OpenGL commands, such as state changes, rendering and changes to connection state, are completed as soon as possible. If your program cannot continue until the commands are actually completed, use the blocking glFinish instead.


Typical usage would be to call this function before waiting for user input.

 do_rendering(); // program-defined function
 wait_for_user_input(); // 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