frames counter

hy there

what is the best way to count the frames “in” glut?

bye

apo

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.