Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

why is fps 20 when framerate is capped at 30? (it's 300 fps when uncapped)

edited November 2013

hi everybody, i am working on an opengl sketch that shows an animation with flat polygons floating from left to right and a 3d bottle (retained pshape) moving from top to bottom.

when i run the sketch with uncapped framerate i consistently get about 300 fps. the framerate never drops below 250 in this case.

when i run the sketch with the framerate capped at 30 fps (which is my aim) i get a framerate jumping between 20 and 30 fps.

i would like to cap the framerate at 30 fps and it should never drop below 28 fps. to my understanding this should work as i get the 300 fps when running uncapped. can anyone explain me why the framerate is getting so low when capped at 30 fps if it can be 300 fps when uncapped?

Tagged:

• So when you don't use the frameRate() function the sketch runs at about 300 fps?? Than should not happen. You are using println(frameRate); right?

• no, i do not use frameRate(). i calculate the frameRate with this piece of code:

``````  fcount += 1;
int m = millis();
if (m - lastm > 1000 * fint) {
frate = float(fcount) / fint;
fcount = 0;
lastm = m;
}
fill(0);
text("fps: " + frate, 10, 20);
``````
• hi gotoloop, i know that variable but i am not using it on purpose. i found the above code for calculating the framerate in one of the pshape-retain-processing-examples by ira greenberg. so i guess it's ok to do it that way.

• edited November 2013

i found out another thing. the "buggy" behaviour i described in my start-post doesn't occur all the time. at the moment it's running at a nice 30 fps (framerate capped at 30). 20 minutes earlier it ran at jumpy 20-30 fps (framerate capped at 30).

i do not understand why the fps is behaving so inconsistent. i have the impression that it works better after i run some other demanding program, e. g. a 3d game.

as if the graphics card is switched into a higher gear by the 3d game and stays there for my sketch.

but maybe i am hallucinating. but fact is the fps i get is far from consistent. it's totally jumpy. sometimes up. sometimes down.

i am doing this on a macbook pro 2011 running under windows 7. graphics card is an amd radeon 6750m. i am using the newest version of processing and java.

HELP

• I believe MBPs with dedicated cards will try and minimise how much they use it, and switch to integrated graphics where possible. I don't have one with a dedicated GPU to test but might be worth looking into.

• hey velvet, thanks for the idea. i already thought in that direction. but as far as i know under windows only the dedicated graphics card is used. only mac os is doing the switching thing. this is what i read everywhere.

• a new observation: the problem is not happening when i cap the framerate at 60.

even when the problem appeared a minute before running with capped at 30. after i change the cap to 60 the problem is gone. strange.

does anyone experience the same problems?

• Maybe a v-sync issue then? Do you have the AMD Catalyst Control Center installed? Have a poke around in the 3d application settings there if you do.

I really have no idea, in case you hadn't noticed... sorry :(

• edited November 2013

thanks for the pointer to catalyst control center. i will play around with it.