Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

xArtx

macrumors 6502a
Original poster
Mar 30, 2012
764
1
Hi Guys,

I have an issue where the same program, when launched from the device
that potentially runs at 40 FPS, can start at 40 FPS, or it can start anywhere
from 22-30 FPS, and then make it's way up to 40 FPS within the first
minute of being launched.

I have tried doing the whole program inside a DrawRect routine,
calling setNeedsDisplay on a timer set to fire 50 times per second,

Also, I have tried PerformSelectoronThread:setNeedsDisplay,
so then I don't need to call it on a timer.

Next, I tried the simplest DrawRect routine like this:
Code:
- (void)drawRect:(CGRect)rect {
    [myImage drawInRect:rectx];
}
where all drawing code is in a refresh routine called by a timer
in the ViewController.

Finally today, I robbed from a GL sample, the code that starts a runloop watching the screen refresh,
and fires the same code that the timer was calling,
but now there is no timer in the program at all.

Any ideas as to why it's still happening?
I expect FPS count to change from device to device, but not from launch to launch.
Cheers, Art.
 
iOS is shuffling applications around in the background to give yours the resources it needs to run smoothly - in doing so yours might be constrained for the first few moments.

Your draw routines should account for how much time has passed between each draw.
 
iOS is shuffling applications around in the background to give yours the resources it needs to run smoothly - in doing so yours might be constrained for the first few moments.

Your draw routines should account for how much time has passed between each draw.

It's a little different than any app I've seen before.
I have seen game/demo type app stutter, but not behave like this.
One thing I have not yet tried is processing in another thread.

It is also possible to limit to 30 FPS which is quite reasonable for the app,
but seems a shame when it can do up to 50 depending on the device.

Variable speed is already happening.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.