SwapBuffers problem
I recently added time based stuff to my project, but there is a small problem. When vsync is off, everything runs perfectly, but when I turn it on, every once in a while the delta for time will come up with a very small ammount followed by a humoungous ammount the next frame, and the animation jerks for those two frames. Anyone have a solution to this?
I haven't experienced such problem but one of the solutions would be to not use time delta directily but interpolate it with the one from last frame. Something like:
This should get rid of some of the spikes in framerate.
float temp = GetRealDeltaTimeForThisFrame();float interpolation = 0.5; // <- select something in 0.0 - 1.0 range that will work nice for youdeltaTime = (temp * interpolation) + (deltaTime * (1 - interpolation));
This should get rid of some of the spikes in framerate.
It might very well be the timer you're using. I experienced the same thing in some of the demos accompanying the GLFW library. It turns out that the timer was causing a problem identical to the one you described. I'm not sure why, or if it was the library, or perhaps just my system, but I think it might have had to do with the precision of the timer available.
Cheers!
Cheers!
QueryPerformanceCounter doesnt work correctly with a lot of laptop and also with the new desktop cpus that are coming out (ones that throtlle the cpu speed)
but thats not the problem
perhaps look into this method
http://www.mindcontrol.org/~hplus/graphics/game_loop.html
http://www.flipcode.com/cgi-bin/fcarticles.cgi?show=63823
but thats not the problem
perhaps look into this method
http://www.mindcontrol.org/~hplus/graphics/game_loop.html
http://www.flipcode.com/cgi-bin/fcarticles.cgi?show=63823
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement