Handmade Network»Forums
1 posts
OpenGL Inconsistent Frame Timings with VSync
Edited by bolonie on
Hi guys. I've been following Handmade Hero, and I started playing with OpenGL off to the side. I have VSync enabled, but when I time my game loop my frame times vary between 14-18ms, while usually being pretty close to 16.6. I was wondering what the reason for this could be. I know that SwapBuffers effectively blocks your thread while waiting on the VSync, so could it just be the driver taking longer/shorter to give my thread back control? I think this may make sense cause normally a 18ms timing is followed by a 14ms timing. I don't really know why it would be like this, but I would really appreciate any thoughts people more experienced with OpenGL / Graphics may have.

EDIT: I am doing this on Windows using GLFW. I am not really rendering anything (just a cube), so basically the most barebones OpenGL code you can get + timing with std::chrono.
183 posts / 1 project
OpenGL Inconsistent Frame Timings with VSync
If one uses exclusive full-screen to lower the screen resolution, the GPU drivers might add an additional pass of upscaling that starts after your complete render is supposed to be displayed. Then you get even worse tearing because the seam ends up around 6-10 centimeters below the top of your screen. If this is the case, you can make the error go away by always using the original desktop resolution (which is usually set to full native resolution) or upscale it yourself on the GPU before synchronization with the up-scaled image. Up-scaling yourself also gives more artistic control over interpolation if making a retro game.
Simon Anciaux
1341 posts
OpenGL Inconsistent Frame Timings with VSync
Could you share your code (and build script) so we could have a look ? What OS and what graphics card do you use ?