View Full Version : 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 =)
bondi
12-06-2001, 01:17 AM
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 =)
hilbert
12-06-2001, 08:35 PM
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/
Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.