PDA

View Full Version : glutTimerFunc timing problem



amoskoh
11-02-2004, 06:17 PM
I have a timer function that calls on a function to draw an object at a certain time. I get the time using this function:
time_elapsed = (clock()-startTime)/CLOCKS_PER_SEC;

My timer function calls itself again every 40ms seconds.
My problem is that time_elapsed increases extremely slowly (it seems to be stuck at 1 forever and probably increases more slowly) so my object is never drawn.
But if I make the timer call itself at values 100ms and higher, it works fine.

Rawk
11-05-2004, 01:29 PM
Hi,

Without more information, it's difficult to say, but you might look at your types?

When you have a division that gets stuck at 1 forever only when it's above a certain value, it implies a typing problem. You could just cast evertying (float) and see what changes...

Hope that helps
-Rawk