glFlush and glFinish

Started by
10 comments, last by Silly_con 20 years, 11 months ago
You would not want to call glFinish after every rendering operation. The time that is wasted wating for the glFinish operation to return could be spent executing other sections of code in your program. Only use glFinish in a situation where it is absolutely essential that the previous rendering operations have completed. If you order your operations right you shouldn''t have to use this command anyway. Just stick anything that relies on the rendering operations being complete at the end of your idle loop.

As for what glFlush does, it forces any pending rendering operations to begin, but doesn''t block waiting for them to finish. It''d probably be good form to stick a glFlush at the end of your rendering loop, but not a glFinish.

glFlush and glFinish mostly have applications where you''re distributing an application over a network, and you want to control the timing of when rendering commands are issued to the other computers. They can be used to help keep them all in sync, and ensure that all the rendering operations are issued when you want them to be issued.

Advertisement
Allright, i think i understood that. Thanks to you all. But was sphinx23 really right when he said SwapBuffers doesn''t execute the pipeline? I think if SwapBuffers swapped immediately instead of waiting for the pipeline you would get half rendered frames, right? So i guess SwapBuffers calls glFinish (or does something similar). And if so i think it would be advisable to 1st do all the rendering stuff, then do all cpu intensive calculations for the next frame and last call SwapBuffers. Or in other words call SwapBuffers BEFORE rendering, not AFTER like in many OpenGL examples. Am i right with my assumptions?

eloso

This topic is closed to new replies.

Advertisement