How to create timer
I want to create a timer that will start when user press any key and will stop when it equal to 0 or when it reach the specific time. Can I create the timer using sytem time (Windows time) and how do I read it in GLUT. Can anyone help me?
Under windows, if you want a real good precision with your timer.
Use QueryPerformanceFrequency to get the frequency of the timer and QueryPerformanceCounter to get the value of the timer.
Call each frame QueryPerformancCounter to know the new value and subtract it with the precedent value to get the delta time.
Use QueryPerformanceFrequency to get the frequency of the timer and QueryPerformanceCounter to get the value of the timer.
Call each frame QueryPerformancCounter to know the new value and subtract it with the precedent value to get the delta time.
see glutTimerFunc (but perhaps u might wanna have a look sdl for more accurate timing stuff)
also QueryPerformanceFrequency is the slowest method of getting the time in win32
http://uk.geocities.com/sloppyturds/gotterdammerung.html
also QueryPerformanceFrequency is the slowest method of getting the time in win32
http://uk.geocities.com/sloppyturds/gotterdammerung.html
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement