Strange FPS difference

hi,

i am new to opengl but know c/c++ for years.
i just wrote my first opengl app and it works pretty fine.
but one thing is strange.
9 times out of 10 when i start the programm i have 15 FPS ( 1200x800:16@60 ) but 1 out of 10 i have a framerate of 30 - 40.
than the game is very fast and everything is renderd propably as well…
and i have no idea why … i have no frame limit implemented.

can someone give me a hint ?

thanx
uwi2k2

Strange. Sure you don’t start your program twice 9 times out of 10 ? Is your card doing other stuffs while you run your program ?

You have a reason to go for 16bits per pixel, instead of 32 ?

It could be a vsync issue, where you’re on the borderline of being able to complete each frame in time to be displayed.

eg. At 60 Hz, you have 16.66 ms to complete rendering in order for it be be swapped at the correct time. If you take less than this time, then you will maintain 60 FPS. If you take 17ms to render, you will need to wait for the next vsync event to occur at 33.33 ms, so your FPS will drop down to 30 FPS.

A slight difference in conditions when you start the program could be pushing you just over the limit, causing quite a large decrease in measured FPS. Try turning off vsync, or speeding your code up.

The frame rate with vsync on will be equal to the monitor refresh frequency divided by the number of interval periods that you need to render your scene completely.

less than 16.66 ms = 60 FPS
16.66 to 33.33 ms = 60/2 = 30 FPS
33.33 to 50 ms = 60/3 = 20 FPS
50 ms to 66.66 ms = 60/4 = 15 FPS

I’d recommend only switching vsync on if you’re capable of rendering faster than the refresh frequency.

If you’re not adjusting vsync (with eg. http://www.opengl.org/registry/specs/EXT/wgl_swap_control.txt), then check your driver control panel, which can usually force vsync on/off, or allow applications to decide.

Hi,

thanks for all the answers…
i will check them an come back here to post the result…

thanks !!

hi guys,

sadly nothing worked out, but i checked some other strange behaviors.
i comented out all stuff in my display func, so i just get a black space…
if i run the game in a 800x600 window FPS is round 50
if i run the same in fullscreen 12800x800 its only round 15 FPS
as long as i do not draw anything… shouldent it be quite the same fps, as only calculations are done ?

uwi2k2

hi,

update: now i changed something:

//glutGameModeString( “800x600:16@70” ); //the settings
glutEnterGameMode(); //set glut to fullscreen

i commented out the settings, and now more ofen i get a frame rate above 100 FPS … but the normal status is around 26,27 FPS…
sooo strange …

uwi2k2

Like ZbuffeR said, try a 32 bpp (or 24).

Between, your framerate looks very slow when you render nothing. What OS, graphic card, driver, running GL version, do you have ?

hi,

i am running it on win xp, hp compaq laptop. i need to check the gl version, but ist quite old…
i will test the 32 bpp or 24

thanx a lot

ok,

to tell you the result:
i am a fool ! i should have check my available display modes.
setting it to one that is really available on my pc givs me a solid frame about 17-18. but according to what i am really rendering i guess thats slow …
anyway i just did something wrong here.

uwi

hi again,

i am sorry to say, but it still happens …
using the right setting improves the fps but still from time to time, suddenly everything renders at twice the speen …
any ideas left ?

thanx a lot
uwi