glutDisplayFunc fps limit?

SummerLand
Unregistered
 
Post: #1
Someone know how to limit to 60 fps the glutDisplayFunc in glutGameMode? ThanksHuh
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
I don't think it can be done simply with GLUT, so maybe the answer is, what do you actually want this for?

One possibility is, in your idle function (where presumably you call glutPostRedisplay(), check if 1/60th of a second has elapsed since you last called it, and if not, don't call it.

If you want Mac OS X only, you could sync to the refresh rate of the monitor like this:

Code:
CGLContextObj context = CGLGetCurrentContext();
const long SYNC_TO_REFRESH = 1;
CGLSetParameter(context, kCGLCPSwapInterval, & SYNC_TO_REFRESH);

I'm sure you could do something similar with AGL, too, for Carbon.
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #3
Quote:Originally posted by OneSadCookie
I don't think it can be done simply with GLUT, so maybe the answer is, what do you actually want this for?


I'm no 3D programmer (yet Wink), but be sure to put speed checks because in ten years, what if someone with a 2THz computer comes along and wants to play your game Wink
I am trying to play Descent I on my 400MHz G4, and the ship 'bob' goes so fast that you would think that there was an earthquake! Completely unplayable... Sad
Steven
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  glutDisplayFunc() - "Objective-C" KidMesh 1 2,733 Nov 8, 2009 09:19 AM
Last Post: DoG
  texture limit reubert 1 2,320 Jun 20, 2003 09:52 PM
Last Post: OneSadCookie