glFlush tells gl to execute all commands and returns immediatly. glFinish does the same but waits until all commands are executed.
Now my question: How is the best way to use these commands. There are two ways i would think of:
while (active)
{
draw objects
glFlush / glFinish
other code (input, etc.)
SwapBuffers
}
—or
while (active)
{
draw objects
glFlush / glFinish
SwapBuffers
other code (input, etc.)
}
I would prefer the first one, because while the graficscard still calculates you can do input and other stuff and therefore do it syncron. But does SwapBuffers tell the graphiscard only to swap the buffers and then returns or does it really perform the action itself and so waits until the buffers are swapped? Therefore i am not sure if the second method may be faster.
I hope you understand my question.
Jan.