Had always a problem to remember a distinction between glFinish and glFlush calls. To fight the issue I’ve created two pictures which serve as a mnemonic helper.
Below is the demonstration of glFinish work:
So we have following participants:
- Application which issued several OpenGL and finally calls glFinish;
- Video Card Driver which has a queue of OpenGL commands previously issued by application: A, B, & C;
- GPU which already runs previously issued OpenGL commands: D, E & F
After a call to glFinish application will block until all commands presented on picture are executed by GPU.
glFlush is similar but has lesser guarantees – it only ensures that all pending OpenGL commands have reached GPU. Moment when commands are actually executed remains unknown.
More details are available here: https://www.opengl.org/wiki/Synchronization.