English 中文(简体)
How many 1024*1024 pngs can be load in openGL for iphone without having the app crash in the device ??
原标题:

Approximately what s the maximum number of 1024x1024 32 bit .pngs which can be loaded at the same time with openGL in iphone ?, without risk of the app crashing.

And .pvr ? a much higher number ?

If I need a huge amount of textures in my game, is healthy to keep loading and calling dealloc to not overload the memory with all the textures ?

最佳回答

You should load textures as required and unload unused textures when your application receives a low memory warning.

To answer your maximum memory question, it seems that the iPhone 2G/3G gives memory warnings around the 20 MB mark and iPhone 3GS starts to give warnings around 128 MB.

1024 * 1024 * 32 bits = 4 MB

So that s about 5 textures loaded before you get warnings. 1024 x 1024 is quite large (it s the largest you can have AFAIK) for a texture, so if possible you should reduce their size.

Note: My warning threshold values aren t official, they re just from experience and from other questions on stackoverflow.

问题回答

PVRTC can be used with either 2 or 4 bits per texel, which is a huge saving. It s not possible to give a specific number for the amount of texture memory which is safe to use. Apple really dropped the ball on this, see this and this articles from Noel Lopis.

Also remember that if you re using mipmaps it takes 33% more memory (each mipmap is 1/4 of the level above => 1 + 1 / 4 + 1 / 16... ~= 1.33).

EDIT: One more note PVRTC doesn t work well if you have a very distinct alpha mask that you want to preserve.

I hope when you say "and calling dealloc" you mean "and releasing those objects with -release" because you should never ever call -dealloc on any object yourself.





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签