OpenGL issues for iPhone and NSTimer

I have an NSTimer that runs at 60Hz. With an OpenGL scene loaded and rendered, my game can get 60 fps, solid, all day long. Then if I go and recompile the app or reload it, it gets 40fps. The same resources are loaded. I have been facing this problem for many years and I just want to know why. This is crazy and I want to know if I should just give up this stupid Timer. The conditions are no different from my 3GS between loads. Sometimes it will get 40fps. Obviously, the clock speed does not differ between loads, so the performance numbers should be constant in a constant scene. Here is a log of my frames:

Good load :: -)

FrameRate: 61 FrameRate: 61 FrameRate: 61 FrameRate: 60 FrameRate: 60 FrameRate: 61 FrameRate: 60 FrameRate: 60 FrameRate: 61 FrameRate: 60 FrameRate: 61

Now I will go further, do nothing, recompile and run:

FrameRate: 43 FrameRate: 50 FrameRate: 45 FrameRate: 48 FrameRate: 40 FrameRate: 45 FrameRate: 42 FrameRate: 41 FrameRate: 42 FrameRate: 44 FrameRate: 41 FrameRate: 46

^ - Massive visual differences. What flying trait can cause this?

USED ​​scene area, SUCH camera setting. There are no variables.

[Edit] Some have mentioned that music not working in the hardware decoder can cause this and sometimes the decoder will NOT be captured even if you tweak it. However, I can say that even when the music is turned off, this happens [/ Edit]

+2


a source to share


1 answer


Have you tried using CADisplayLink

this instead? From the documentation :

The CADisplayLink object is a timer object that allows your application to synchronize its drawing with the update display speed.

...

Once a link to an image is associated with a run loop, the selector on target is called when the screens' content needs to be updated.



I haven't used it personally, but it looks like it can help with any lower frame rate problems, even if it doesn't increase the frame rate per se.

+2


a source







All Articles