views:

309

answers:

1

Hello,

I am developing an iphone game using cocos2d and have it set to to show the FPS. Now most of the time the application will start and run at 60 fps, However apparently randomly sometimes the application will start and top at only 40 fps.

This does not happen often and seems to happen only when you quit the application and restart it as soon as possible, allthough this does not trigger the effect most of the time. But after a few quick quit-restart sequences the game eventually starts and has only 40 fps instead of the normal 60. If I quit the application at this point and wait for about 3 seconds it will again start with the normal 60 fps.

I am assuming this has something to do with the application not being able to free all of its memory before starting again?, this problem seems to be related to the iPhone OS.

It is important to note that this never happens if I quit the application wait 5 seconds and restart. Has anyone had this sort of problem before?. Any ideas of why this might be happening?.

-Oscar

+1  A: 

If anyone is wondering this is because there used to be a bug when emulating the OPEN GL 2.0 in the iPhone 3GS/iPod Touch 3G, this has been fixed for OS 3.1. And all you have to do is the following:

// Try to use CADisplayLink director
// if it fails (SDK < 3.1) use Threaded director
if( ! [Director setDirectorType:CCDirectorTypeDisplayLink] )
    [Director setDirectorType:CCDirectorTypeThreadMainLoop];
OscarMk