Situation:
cocos2d on iOS. In the simulator my FPS shows 60 when in standard-resolution device mode, and 30 (exactly half) when in retina device mode. Googling yielded no immediate results...Any reasons why?
Code:
- (void) applicationDidFinishLaunching:(UIApplication*)application
{
// Init the window
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Init the View Controller
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
viewController.wantsFullScreenLayout = YES;
// Try to use CADisplayLink director
// if it fails (SDK < 3.1) use the default director
if( ! [CCDirector setDirectorType:kCCDirectorTypeDisplayLink] )
[CCDirector setDirectorType:kCCDirectorTypeDefault];
// Create glview
EAGLView *glView = [EAGLView viewWithFrame:[window bounds]
pixelFormat:kEAGLColorFormatRGBA8
depthFormat:0
];
// make the OpenGLView a child of the view controller
[viewController setView:glView];
// make the View Controller a child of the main window
[window addSubview: viewController.view];
[window makeKeyAndVisible];
// Create director
director = [CCDirector sharedDirector];
// attach the openglView to the director
[director setOpenGLView:glView];
#if GAME_AUTOROTATION == kGameAutorotationUIViewController
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
#else
[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
#endif
[director setAnimationInterval:1.0/60];
[director setDisplayFPS:YES];
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
// Set premultiplied alpha
[CCTexture2D PVRImagesHavePremultipliedAlpha:YES];
// Default texture format for PNG/BMP/TIFF/JPEG/GIF images
// It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
// You can change anytime.
[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
// Enable High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
[director enableRetinaDisplay:YES]
[self removeStartupFlicker];
[SceneManager goLoadingScreen];
}
Update:
Maybe it's just a simulator issue? See http://www.cocos2d-iphone.org/forum/topic/20367
Why not just test on a device?
And I can't just test on my retina device because I ignorantly upgraded my iPhone4 to the newest version of iOS and I'm not ready to shell out $30 for the Lion update yet...
Reason might be there's no explicit GPU hardware acceleration of the iPhone simulator. Test on device, everything should be fine.
My game is 8fps on iPad retina simulator, but 60 FPS in real device. Test game performance with real device and don't worry about simulator.