timer function

Does anyone have any examples/ idea how to implement an openGL timer function???
For example I would like the program to call a function redraw every 4 secs.

I read about the function glutTimerFunc. But still unsure how to use it. Will some kind soul help???

Thanks.
an opengl idiot =)

you can use Windows timer function.
Use SetTimer(ID,time intervall in ms, NULL);
to set up the timer.
and make a message handler for WM_TIMER

for example;

void Init()
{
//windows sends WM_TIMER every 4 sec
SetTimer(1,4000,NULL)
}


case WM_TIMER:
update();

void update()
{
//update the screen
}

Thanks bondi,

However, I am working in an unix environment,
so cannot use the windows functions.
Thanks anyway =)

Try to #include <unistd.h>//unix standard
than call the function usleep( int sec )
where sec is micro second. type info usleep for more information!!
Try my masterpiece http://sourceforge.net/projects/mathdev/