OpenGL Frame Rate

Started by
10 comments, last by ma_hty 14 years, 7 months ago
I call it once at initialization, after all extension have been loaded. Its actually the first thing i call.
Advertisement
Quote:Original post by Sigvatr
Yeah, I'm going to thread my code so I don't swap back buffers until an entire new one is completed rendering, so I can do manual a Vsync and have the rest of my game code in it's own thread.


Using different threads for logic routine and graphics routine is the right way to go. However, you shouldn't turn off Vsync if you are using this approach. Instead, you should leave Vsync enabled.

Just in case you doesn't notice. if your program behaves correctly, its window will not be redrew unless a portion of the window is changing from invisible state to visible state or you tell it to do so explicitly. So, if you don't want the window to be redrew, you just need to stop firing redraw command.

Turning off Vsync is only useful for the lazy guy who want to implement both logic routine and graphics routine within a single thread. However, the flaws of this lazy approach is simply too obvious to be tolerated. (At least, I won't forgive.)
Quote:Original post by Trienco
... Sure you can disable that for testing or benchmarking, but at 1000fps you end up with seeing 16 horizontal stripes of 16 different frames because you swap out the framebuffer right under the monitors a.. backside. ...


It is incorrect to measure framerate (benchmarking) by simply turn off Vsync. The framerate measured this way didn't not take into account the more demanding graphics operation.

Lets put it this way. The OpenGL command you called would not be executed immediately at the time you call it. Instead, it is buffered. If you try to test the framerate by simply turn off Vsync, you measure the time taken to upload the OpenGL command to the buffer only. You can verity this problem very easily. You draw a full screen quad with Vsync ON and do something fancy in the fragment shader which lowered the framerate well below 60 fps. Afterward, you turn off Vsync and measure the framerate again. You will find that the lateral case took no time to complete, which is simply not reflecting the fact at all.

This topic is closed to new replies.

Advertisement