PDA

View Full Version : frames counter



apocalexiz
08-24-2003, 09:38 AM
hy there

what is the best way to count the frames "in" glut?

bye

apo

marcus256
08-25-2003, 02:24 AM
Put a counter in your display or idle funciton (using a global or static variable), depending on where you draw your display. If you want FPS (frames per second) aswell, you can use glutGet(GLUT_ELAPSED_TIME), which returns the value of a free running timer (in milliseconds), to calculate the number of frames per second (FrameCounter/TotalTime, or something similar).

You should be aware that the timer does not give better resolution than 10~50 ms under Windows though, so be careful to check that you do not put zero in the denominator of the division.