I'm having trouble distinguishing the practical difference between calling glFlush()
and glFinish()
.
The docs say that glFlush()
and glFinish()
will push all buffered operations to OpenGL so that one can be assured they will all be executed, the difference being that glFlush()
returns immediately where as glFinish()
blocks until all the operations are complete.
Having read the definitions, I figured that if I were to use glFlush()
that I would probably run into the problem of submitting more operations to OpenGL than it could execute. So, just to try, I swapped out my glFinish()
for a glFlush()
and lo and behold, my program ran (as far as I could tell), the exact same; frame rates, resource usage, everything was the same.
So I'm wondering if there's much difference between the two calls, or if my code makes them run no different. Or where one should be used vs. the other.
I also figured that OpenGL would have some call like glIsDone()
to check whether or not all the buffered commands for a glFlush()
are complete or not (so one doesn't send operations to OpenGL faster than they can be executed), but I could find no such function.
My code is the typical game loop:
while (running) {
process_stuff();
render_stuff();
}