problem - low FPS rate

Hi,

I have written an OpenGL program in MS VC++ 6.0 and in it i only draw some basic primitives and display fonts.

I have calculated FPS… about 60 frames per second on GeForce 3!!! (800x600x32 not using GLUT or other libraries)

But if i press and hold any key, the FPS grows up to 120 and even more.

What kind of bug is it? If anyone can describe this bug please help!!!

Several possibilities come to mind:

  • the display has vsync and you are using a 60Hz screen resolution (only if the upperbound is always 60fps)
  • your frame-drawing code is not triggered frequently enough (the key-press increase seems to hint at this being the problem)
  • you use no hardware accelerated driver

HTH

Jean-Marc

Hi,

I do use harware accelerated driver and my screen refresh rate is 75Hz.

But what do you mean “not triggered frequently enough”? In WinMain I have code like this:

while (applicationactive){ //no one is quiting our programm

/
Handling windows messages throught WindProc
/

DrawScene(); //opengl stuff here

// Calculating fps is here
}

I mean my “while” must work infinitely, until we are quiting, and it must call DrawScene() as fast, as it can… but it doesn’t…

I`ve tested this prog bouth on Riva TNT2 (Win98) and GeForce 3 (WinXP), but results are the same. What should i check?

P.S.: There aren’t any errors in calculating FPS (checked)…

OK, your replies seem to rule out my initial guesses. That leaves your drawing code.

Check for redundant loading of textures, or repeated calling of initializing/state setting code.
Also using direct mode (as opposed to using display lists) can be much slower.

Without better indication of the heavily used areas in your application it is quite difficult to give additional general advise.

BTW, before switching to GLUT I used the following main loop (based on NeHe’s tutorials):

while(!done){
if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE)){
// handle windows messages
if( msg.message==WM_QUIT){
done=true;
}else{
TranslateMessage( &msg);
DispatchMessage( &msg); // this will activate WindowsEventCB if necessary
}
}else{
// do some work
if(myKBHandler.GetKeyStatus(VK_ESCAPE)){
done = true;
}else{
if( !pause){
myGLContext.DrawGLScene();
}
}
}
}

Jean-Marc

[This message has been edited by JML (edited 02-21-2002).]

I too have noticed in some glut programs, that if I hold a button down, the fps increases quite a bit. I think the Sphere dot(draws a sphere with dots and tells you dots per second) program in downloads from nehe does this.

Thanks for help!
I’ll check everything one more time…
Maybe I realy have some reinitializations per frame…