What are the necessary steps to update an existing OpenGL ES 1.1 based 2D iPhone game to be compatible w/ the iPhone 4's retina display? I'm still using the Texture2D class that came w/ Apple's CrashLanding (download) sample code.
After reading Apple's documentation, watching the WWDC video (session 134 "Optimize Your iPhone App for the Retina Display"), and looking at Cocos2D sample code I'm still confused.
I believe the required steps include:
- passing high-res artwork (w/ "@2x" appended) to
[UIImage imageNamed:@"image.pn开发者_StackOverflow中文版g"]
- changing the "contentScaleFactor" from 1.0 to 2.0 (where?)
- updating the arguments to
glOrthof
to include the contentScaleFactor - adjusting the size of the
glViewport
Please note that I'm relatively new to OpenGL.
Thanks for your help!
You should keep the 320x480 image, and provide the 640x960 image with a different name. Suppose the 320x480 image is called foo.png
, then name the 640x960 one foo@2x.png
.
The system will then automatically select the higher resolution one on iPhone 4, without any change in code — assuming you were using [UIImage imageNamed:@"foo.png"]
.
精彩评论