vsync disabled owns timeGetTime

Started by
8 comments, last by Silex 19 years, 11 months ago
I calculate my time delta between frames using timeGetTime. I use it for things like camera movement. Works fine with vsync enabled, but when I disable it my camera screws up because I think the time delta''s are so small they''re getting rounded to 0. Is there a more precise function I could use? Thanks
Advertisement
Look at QueryPerformanceCounter.
On Windows you can use the performance counter:
__int64 counterfreq;__int64 t;QueryPerformanceFrequency((LARGE_INTEGER*)&counterfreq));QueryPerformanceCounter((LARGE_INTEGER*)&t);



[edited by - frankd on May 30, 2004 7:07:45 PM]
Is QueryPerformanceCounter significantly slower than timeGetTime?
... why are you worried about the time that a timer system call takes, when you just finished telling us that your problem is that your FPS is too high for the existing timer?
Because right now I''m rendering two wireframe triangles, but I plan on adding one or two things later on.
I''m having the same problem,but I''m writing my code cross-platform. Is there a way to find time accurately in C#/.net without importing a function from a Windows ,dll?
I believe GetTickCount() is the command in C#/Windows. As for the clock data rounding off, just put in a max frame rate at say 70FPS, that should ensure that your camera movement will work properly.

--------------------------------------------------------------------------------
Good Links: C++ Reference, Java API
SDL Home Page, Lua Scripting Language, Python Scripting Language
Chris Taylor''s Design Document (Downloadabe MS-Word Only), Blitz Basic Homepage
QueryPerformanceCounter() takes about 10 clocks, I believe.

timeGetTime() takes 100+, and is very, very inaccurate.

There is no good, portable method for accurate timing that doesn''t have fairly excessive overhead. The best you can do is run the appropriate function for the OS you''re compiling for.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.

Oops, looks like my current System.Environment.TickCount has accuracy over 60FPS, good enough for me. My current ~10 textured quads were just running at over 800 FPS.

This topic is closed to new replies.

Advertisement