views:

157

answers:

1

I am developing a 2D game for the iPhone and iPod Touch using OpenGL ES 1.1. Everything works ok on the iPhone, iPhone 3G and all iPod Touch models. The game usually renders the scenes at ~60 FPS.

This happens on the iPhone 3GS also, but sometimes (it's completely random) the 3GS drops the framerate to around 40 FPS and the animation seems choppy. This also happens if the user locks the phone and resumes it from sleep mode.

I think it has someting to do with the NSTimer because if I change the draw trigger mode to the new CADisplayLink class available from SDK 3.1+, everything is OK on all devices... and on the 3GS too.

I don't know how to solve this issue and I don't want to post my app with the 3.1+ restriction. There are still a lot of users out there with 3.0 devices.

Anyone having this issue with the iPhone 3GS too? If so, please help me with a workaround.

Thank you!

+2  A: 

You can use both libraries and get the best result on either 3.0 or 3.1 devices. This would be fine since the iPhone OS minimum version that the AppStore uses is contained in your application's Info.plist file.

The iPhone OS version is retreivable using the following code from Apple's UI Device Class Reference:

float iPhoneOSVersion = [[[UIDevice currentDevice] systemVersion] floatValue];

if ( iPhoneOSVersion >= 3.1 ) {
    useNewerFramework();
} else {
    useOlderFramework();
}

However you should also make sure you set your deployment target in Xcode to 3.0 or whatever minimum version you wish to run on.

Brock Woolf
Did you encounter the same issue on the 3GS too?