tags:

views:

153

answers:

2

I'm making an openGL game for iPod/iPhone.

At start I load at once all the textures I need. At first loading times where small, but as I kept developing and adding new textures the loading times have been increasing, to the point of taking many seconds before the game start.

Recently a new problem appeared, when I build the game in the device It takes too long and the game quits. At the app is installed correctly and i can test It, but never while being connected to xcode. Sometimes even the app quits, when too many elements are dran on screen.

Right now I use 6 files , with about 2 Mbs of size in total.

Is there a form to create a loading screenor the such ?

What other meassures can I take so solve this issues ?

+2  A: 

If you're decoding PNG files at startup using Core Graphics, I would suggest using PVRTexTool to create PVR data files instead. The contents of PVR files can be uploaded directly to OpenGL; no need to use Core Graphics to decode them.

PVRTexTool can also do neat stuff like generate mipmaps (another thing you might want to avoid at startup time) and encode to compressed formats (reducing your texture size will help too).

prideout
A: 

Besides encoding your textures as PVR-textures there are a few more solutions.

One is to defer texture loading to a later point. Let your app bring up its user interface and maybe show a progress bar to the user while you're loading your textures. This will stop iPhoneOS from killing your app.

You'll probably also need to look into what kind of textures you are creating. Some formats are much more expensive than others to create from you png:s.

As a last resort you could save your textures as uncompressed raw textures. This will make your app larger but cut down loading time.

Jens Utbult
As a point of reference: In our current project we load about 2.0 MB of PNG and 0.5 MB PVR-textures in less than 2 seconds on the 3GS. Most of the PNG:s are loaded as 32-bit textures and a few as 16-bit with punch through alpha.
Jens Utbult