Skip to main content
GameDev.net gamedev.net
🔒 Locked

How to setup timer in GLUT

Started by dean78 Jan 4, 2002 at 1:38 AM 1 replies 400+ views
Original Post
dean78
dean78
Hi everyone, I want to setup a timer in my program. This program will display the time using the timer. What my problem is I don't know how to setup the timer. I've look out in many book and found nothing. Recently someone post a same topic about this timer in this forum. One of the guy that reply insisted of using QueryPerformanceFrequency to get the frequency of the timer and QueryPerformanceCounter to get the value of the timer. I'm beginner programmer and don't know how to do it. Can someone explain a little bit more maybe with some coding. Is there any other way to setup this timer? Edited by - dean78 on January 4, 2002 2:43:27 AM
Von
Von
for GLUT, you could simply use the glutTimerFunc() function.

void Update(int num)
{
// Something
// Something
}

int main()
{
unsigned int millisec;
int num;

glutTimerFunc(millisec, Update, num);

return 0;
}

It simply executes the Update function with the num arguement once the time in millisec has been reached.

Used once only though, you will need to call gluttimerfunc again if you want it to work another time.
dean78
dean78
Ok thanx..I''ve tried that. But how do u get the time from the system.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.