glFlush or glFinish?

If you are just about to display your scene onto a window at the end of your rendering code, would you use glFlush or glFinish to ensure that all drawing has been completed? I’m guessing that you would use glFinish because glFlush only guarantees that all commands sent to OpenGL will complete in finite time. Therefore, it might not complete before you swap the frame buffers and present the scene.

If i’m wrong, i’d be grateful if someone could point me in the right direction…


It is much simpler than that :
SwapBuffers implicitely call glFlush and swaps only when all Gl commands are processed. And it is asynchronous, that is the call returns immediately and the job gets done in parallel with cpu operations.

So in most cases when you use double buffering you don’t need glFlush or glFinish.

Unless in very rare cases, glFinish is not to be used, it breaks parallelism between gpu and cpu.