Preparing Graphics for an iPhone game...

Nibbie
Posts: 1
Joined: 2009.02
Post: #1
Hello,
I was wondering if anyone has any advice on how to best prepare graphics for an iPhone game, format, dimensions, resolutions, etc?
I've worked primarily with Flash in the past but want to prepare the graphics in the best way possible for a programmer.
Thanks,
David
Quote this message in a reply
Moderator
Posts: 3,572
Joined: 2003.06
Post: #2
PNGs are best. The programmer can compress them as necessary (to JPG or PVRTC, for example).

Two major things to keep in mind with iPhone are that textures must be a Power of Two in dimension and memory (RAM) is limited.

First, Power of Two (POT) means that the sides of the image must be something like: 64, 128, 256, 512, 1024. The largest dimension available on iPhone is 1024. I think the smallest is 2. So you could have an image that is 128 x 512, for example.

Memory being limited means that it's best not to be wasteful with how you layout your images (try not to leave lots of empty space around them). And for performance reasons it is best if you can put many images in one texture, called an "atlas" or "sprite sheet".
Quote this message in a reply
Member
Posts: 34
Joined: 2009.01
Post: #3
Isn't the power of two requirement applicable to Quartz, OpenGL, or both? I'm pretty sure that Quartz will let you draw images whose dimensions are not powers of two.

Also, I've heard that weird things happen in OpenGL when your texture has an X or Y size < 64. Is there any truth to this rumor?
Quote this message in a reply
Moderator
Posts: 3,572
Joined: 2003.06
Post: #4
I don't recall Quartz being limited to POT sizes, at least not externally; internally it might resize to fit POT anyway, I don't know. I was talking about OpenGL since that's what most games use.

There isn't anything wrong with using textures less than 64 px in either dimension. The rumor you are referring to is likely related to the fact that so many people use Texture2D (and other Apple texture loading sample code) and have run into the issue with garbage showing in the alpha channel in images smaller than 64x64. That is an issue with how Core Graphics loads the image, not OpenGL or the iPhone hardware itself. The fix is to simply replace a malloc call in Texture2D with calloc.
Quote this message in a reply
Post Reply