Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I've recently tested an OpenGL ES based 2D game on the iPhone 4. I've done almost all of the development and testing so far on my 3G device. The game works fine (except for a few multitasking things) on the new device. I'd like to replace some of the artwork w/ "better" artwork that takes advantage of the iPhone 4's higher resolution. How can I do this?

Is there a flag somewhere that tells the phone to scale up some or all of the image resources?

share|improve this question
    
I assume you have artwork that is actually of a higher resolution? Or would you just be scaling up the lower-resolution ones? –  Smashery Jul 26 '10 at 0:56
    
Yes I have artwork of a higher resolution. Currently when I save a 100x100 pixel png-24 it appears as 100x100 pixels on the 3G device... and 200x200 pixels on the iPhone 4. I'd like to actually save a 200x200 image and use that on the iPhone 4 (and the 100x100 on the 3G). –  MrDatabase Jul 26 '10 at 2:42
add comment

1 Answer

up vote 4 down vote accepted

Apple's Documentation: Supporting High-Resolution Screens (requires iPhone developer account)

Some basics:

  • Add "@2x" to your filenames for high resolution files. So you'd have myTexture.png for low-res and myTexture@2x.png for high-res.
  • If you're using UIImage to load in graphics, imageNamed:, imageWithContentsOfFile:, and initWithContentsOfFile: will automatically look for @2x files on the iPhone 4. Otherwise you have to load them yourself.
  • For OGL ES change the "contentScaleFactor" property of your view from 1.0 to 2.0 to increase the size of the renderbuffer.

There's more to it than that depending on what you're drawing and how you're drawing it. The docs are super handy in that regard.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.