Frame Limiter???

I want make a frame limiter for my opengl application, what can i do?

The book OpenGL Game programming has a timer class that locks the frame rate to a specified value.
Move to this URL and download the example of chapter 19:
http://glbook.gamedev.net/source.asp
Open the file HiResTimer.h and take a look at the function lockFPS().
-Ehsan-

many many many thanks, it’s Working :slight_smile:

I suggest you the following alternative.

Let the fps free, and make the motion of the objects proportional to a variable Syncronize that changes depending of current fps.

So you set the number of fps you want your program to run. Let’s say you want animations to run in 60 fps not more not less, that is 17ms.

So if fps is above 60, then Syncronize is less than 1. If fps is below 60 fps, then Syncronize is more than 1.

This way, you multiply all your objects movements by Syncronize, and all events are syncronized in time independently of the current fps.

Example:
glTranslatef MoveXSyncronize, MoveYSyncronize, MoveZ* Syncronize

Hope it helps! :slight_smile: