time based animation tutorial or help please

Can some one pleae help me understand time based animation.

I dont know if you know my project but i have to generate a 3d tree. What i would like to do is make this tree animate once every say second and have the sun move along the sky once every half second.

I dont know how i could do this, could someone please help me with either link to tutorial, pseudocode as to what should happen or just some general advice please.

It would be very much appreciated, thanks.

Did you searched these forums ?
Recent related topics :
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=2;t=016297
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=2;t=016152

Hi, still working on the tree I see.

You can have ether two timers set to go off at diffrent times.

Timer 1 would tell it to update tree.
Timer 2 would tell it to update sun.

Or have one timer and two varaibles.

Tic1 = tree
Tic2 = sun

void Time_loop( void )
{
Tic1++;
if ( Tic1 > ?? )
{
update_tree();
Tic1 = 0; Reset timer
}
Tic2++;
if (Tic2 > ?? )
{
update_sun();
Tic2 = 0;
}
}

Let say out time loop was called every second.

Tic1 > 30 // would mean the tree would be updated every 30 seconds.

So you could set your update time for any number of object this way.

Originally posted by Andrew Davey:
[b]Can some one pleae help me understand time based animation.

I dont know if you know my project but i have to generate a 3d tree. What i would like to do is make this tree animate once every say second and have the sun move along the sky once every half second.

I dont know how i could do this, could someone please help me with either link to tutorial, pseudocode as to what should happen or just some general advice please.

It would be very much appreciated, thanks.[/b]

nexusone, cheers i understand better, also i was confused about using GLUT timer stuff, but i am using C’s time() function to do my timestamps, that works for me.

Cheers.