Animation Event Loop

I want to create a event loop to update once a second the position of a Animated object.
How would I do that under glut?

Example:
glutTimeEvent(timeEvent)

void timeEvent()
{
.move object
.check for valid location
.redraw screen
}

nex,

I am not sure of the type of the program you are programming but you can use the following code if and only if you are animating one object and one object only.

glutTimeEvent(timeEvent)

void timeEvent()
{
.move object
.check for valid location
.redraw screen
delay(1000) // delay thread for 1 second.
timeEvent();
}

I had a couple of things that I wanted to do, like spinning cubes, game object timming.
Also I thought that using a time based loop for Animating things, so that CPU speed would not effect the animation.

Originally posted by Thug:
[b]nex,

I am not sure of the type of the program you are programming but you can use the following code if and only if you are animating one object and one object only.

[quote]

glutTimeEvent(timeEvent)

void timeEvent()
{
.move object
.check for valid location
.redraw screen
delay(1000) // delay thread for 1 second.
timeEvent();
}

[/b][/QUOTE]

After looking I have come up with the glutTimerFunc( time in ms, func(Value), value)

But get an error trying to use it…

Example:
glutTimerFunc( 1000, TimerEvent, 1);

void TimerEvent()
{
do stuff
}