Problem with Texture Memory

Hi everyone,

Like I said in the title, I have a little problem with the texture memory.

To make a quick summary, my colleague and I are developing a play on corona. We like to develop this game on small devices such as Android and iPhone, but also on larger devices like the iPad. Where we may have made a mistake is that we start to develop our game in 1024x768. After several tests, the images rendered quite well on our cell with LetterBox. The image resolution 1024x768 does not cause problems or on our iPod 4 gen. We decided to continue working with this resolution. The problem is that when we test the game, the texture memory rises quickly and easily reaches 110 mb! This is huge, and there is no memory leak, we carefully checked.

After some research, it seems that only the image size, not the weight affects the texture memory … so we should reduce, but our game was designed with large images. So even if we make a version with smaller images with a resolution of 320x480, as well as the images are blurry, we could not do for iPad version, because the images are still too big and take too resources. We would have to create the iPad version with blur images with a resolution of 320x480 …

I enclose an image used in our game in our level, there are about 6-8 images of this size over 4 spritesheets of 1024x2048.

http://imageshack.us/photo/my-images/210/building2terabites.png/

Is this normal with all that we reach 110mb of texture memory?
Is there a way to ensure that images take up less resources? [import]uid: 183291 topic_id: 32984 reply_id: 332984[/import]

Sorry for the double post, but I meant “Game” and not “Play”. [import]uid: 183291 topic_id: 32984 reply_id: 130961[/import]

This is where Dynamic Resolution comes into play. Devices like the iPhone 3Gs don’t have a lot of memory and your app can quickly use it all. OpenGL makes a trade off of memory efficiency for speed and if you have an image that is say 600x300, it ends up using a 1024x1024 block of memory * 4 channels (Red, Green, Blue and Alpha). Once that image became greater than 512px on one side, it jumped to using the next bigger chunk of memory (in powers of two … 64, 128, 256, 512, 1024, 2048)

A 1024x1024x4 image takes up 4MB of texture memory. If your images is 1025 or bigger, that jumps to 2048x2048x4 or 16MB per graphic. Your 4 sprite sheets are taking up 64MB of memory alone.

By using Dynamic Resolution, you provide 3 copies of each graphic

sprite.png
sprite@2x.png
sprite@4x.png

The first graphic with out the @Nx suffice is scaled to a 320x480 device, the @2x is scaled for your 640x960 type device, and the @4x is for a 1280x1920 scale (of course if you want to think of this in ipad sizes, 384x512, 768x1024 and 1536x2048)

The Retina iPad can handle the memory just fine for using the larger texture files. Older iPads and older phones need to keep those textures under 1024 if you can.
[import]uid: 19626 topic_id: 32984 reply_id: 130966[/import]

Sorry for the double post, but I meant “Game” and not “Play”. [import]uid: 183291 topic_id: 32984 reply_id: 130961[/import]

This is where Dynamic Resolution comes into play. Devices like the iPhone 3Gs don’t have a lot of memory and your app can quickly use it all. OpenGL makes a trade off of memory efficiency for speed and if you have an image that is say 600x300, it ends up using a 1024x1024 block of memory * 4 channels (Red, Green, Blue and Alpha). Once that image became greater than 512px on one side, it jumped to using the next bigger chunk of memory (in powers of two … 64, 128, 256, 512, 1024, 2048)

A 1024x1024x4 image takes up 4MB of texture memory. If your images is 1025 or bigger, that jumps to 2048x2048x4 or 16MB per graphic. Your 4 sprite sheets are taking up 64MB of memory alone.

By using Dynamic Resolution, you provide 3 copies of each graphic

sprite.png
sprite@2x.png
sprite@4x.png

The first graphic with out the @Nx suffice is scaled to a 320x480 device, the @2x is scaled for your 640x960 type device, and the @4x is for a 1280x1920 scale (of course if you want to think of this in ipad sizes, 384x512, 768x1024 and 1536x2048)

The Retina iPad can handle the memory just fine for using the larger texture files. Older iPads and older phones need to keep those textures under 1024 if you can.
[import]uid: 19626 topic_id: 32984 reply_id: 130966[/import]