Is it pointless to draw 512times/sec ...

Started by
10 comments, last by Extrarius 19 years, 5 months ago
Quote:Original post by WarAmp
Rendering faster than the refresh rate is pointless. However doing Physics/Input updates faster than the rfresh rate is very much a good thing. The problem with VSync is that it blocks until the refresh happens, which means the whole application stalls until it can swap the buffers.

The 'correct' way to do it would be to keep track of time internally in your application, and only call Render() 60 times a second, but let AI/Physics and especially input happen as fast as possible. (or maybe limit those to happen 120 times a second)

There can be a benefit to doing Physics / Input updates faster than refresh and a loop that only calls Render() 60 times a second is one way of achieving it. You can also use separate threads for rendering and simulation or in D3D use the DONOTWAIT flag on Present() and do some other processing until the refresh is complete.

Game Programming Blog: www.mattnewport.com/blog

Advertisement
There isn't a point in drawing more frames than VSYNCs, but you _DONT_ want to lock to vsync, because it makes slowdowns EXTREMELY more noticable.
Let me explain why:

Your machine is running the game really fast, you're getting 120 FPS with time to spare and the vsync is 120Hz, a perfect match so youre game is running smooth. Now you get to a graphics intensive area, and the frames now take 1/119 of a second to draw. Your FPS is now 60, because you're drawing the frame (during which time you miss the vsync and draw say the top 20 pixel rows of the screen as the old frame) then wait for vsync, so every frame is really taking 2 vsyncs(1/60th of a second = 60FPS) when really it only needs to take 1/119th of a second (119 FPS).

If you just displayed the frame whenever you had it and kept going, you'd have a traveling tear that would be at a different place each screen update, but you'd also have 119 completely different images displaying each second instead of 60.

When you lock to vsync, you should make sure the frames are taking less time than a single vsync because otherwise you're cutting hte framerate by an integer divisor, the lowest of which (2) means you're losing a LOT of potential frames. If you lock to vsync normally, time each frame and when things start slowing down, stop locking to vsync.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk

This topic is closed to new replies.

Advertisement