I’m finding glutSwapBuffers() function a bit slow in some circumstances. I would like to try with equivalent commands in plain GL but I could not find them.
Can someone give me some help/directions on that ?
(I’m using Ruby just in case language implementation became important).
The actual cost of swapping buffers is negligible.
What you see is probably an effect of vsync. Before doing benchmarks, disable it, otherwise you only measure your display refresh rate.
ie : 1 s /60 Hz = 16.667 ms
“swapping buffers is not slow, check doing a glFlush right before”
Yeah, but doesn’t glutSwapBuffers() block until all previously sent data flows out of the rendering pipeline and into the frame buffer before swapping?
My mistake, I meant glFinish().
Normally swapbuffers implies glFlush(), not a glFinish(). Of course the implementation can do a glFinish() instead.
What happens is that the card can buffer a bunch of GL commands before blocking, so you can already have submitted multiple frames without blocking, and before they are actually drawn.