Hi All,
I am working with my project on simulation and now i am having tough time to solve this timer problem.
I am calling two func, FeedWater() & OutputWater() in my RenderScene() func. I am confused how to setup timer for 30fps inside FeedWater() and run my program smoothly, I am using GLUT not Win32.
DESPERATLY LOOKING FORWARD FROM U GUYS TO HELP ME.
Actually I am calling a func. FeedWater() to feed water in every frame and i restrict to 30fps. I have a loop in the render function from frame 1 to 30 and calling this FeedWater() func @ 33ms.
Now the problem is once the control goes to the FeedWater() func, I have to create a timer to be there inside that function for 33ms. Here I need to do some operation.
…but change float to double. Floats have too poor precision (after two days you only have 10 ms resolution, if I calculated it correctly).
Also, delta-times based on absolute 64-bit timer values (such as QueryPerformanceCounter) should always be performed with 64-bit integer math, NOT floating point math.
For a more complete example, see lib/win32/time.c of the GLFW source code distribution. As you will see, it is also more fail safe (works on all Windows computers, regardless of CPU, chipset or OS version).
Note: GetTickCount() is a very poor timer, with less than 10 ms resolution.
[This message has been edited by marcus256 (edited 12-03-2002).]