After realizing that my framerate was being capped precisely by my refresh rate, I got to wondering something else…
Using NeHe’s demos as the foundation…
Sometimes between similiar runs of my program, my movement (adjusted by per-frame time difference) becomes choppy although the framerate is the same. Running it again, my movement may then be perfectly fluid, at the same framerate.
Is it possible that my program is swapping the buffers out of sync with the refresh rate, and hitting a delay waiting for the next one? If so, how do I determine/fix this situation?
The most likely explanation for choppy movement even with a high framerate is some kind of error in your code.
I do not complete understand what you with “swapping the buffers out of sync with the refresh rate, and hitting a delay waiting for the next one” ?
You can turn on vertical sync. (?)
Is it possible that my program is swapping the buffers out of sync with the refresh rate, and hitting a delay waiting for the next one?
Yes this would be happening if Vsync is on.
HOw to fix it? turn vsynch off
When vsync is on, and your program outputs to the screen between the screen’s vertical frames it has to wait for the next frame to write to the screen.
I have noticed this even slowed my whole program down, including the user input! So I always have vsync off now.