texture memory not correct

I created two sprite sheets (by checking autosd) in TexturePacker.
I have setting of 2048 x 4096, autosize , allow freesizes checked.
scale is set to .5
texture memory used shows: 1703 x 2505: Ram:16664 kb.

Each sheet has 6 sprites in it.
For the hi res sheet, photoshop shows 1703 x 2505, 12.2 MB and for low res 855x 1258, 3.08 mb. Both are rgb 8 bits.

This matches up with what texturepacker shows.

The problem is that when I load each file, the display textureMemoryUsed in Corona reports 8.333.608 mb for the low res sheet and 33.554.432 mb, causing the png white screen problem.

Both sheets are png and do not have color profiles.
I can't figure out why the erroneous texture memory usage in Corona.

Your app won't work on a real iPhone 4 since it has a texture dimension bigger than 2048 pixels. It's a hardware limitation. Some phones, such as iPhone 3, have a maximum texture dimension of 1024 pixels. Maybe the memory error is Corona's obfuscated way of saying you are using an unsupported texture size.

@XenonBL

Your're right, but the issue is the reasoning behind the memory usage.

I believe Corona assumes 32 bit depths for images even though they may be created as 8 bits (like my example).

It seems the reported memory is accurate if I calculate it for 32 bit depth.

Why Corona assumes such depth, I don't know.

Perhaps ALL textures are de-compressed/converted to 32 bit once inside the rendering engine, despite what bit format they are stored as.

I seem to recall some discussion about what Corona does to textures as part of the openGL-ES pipeline, but I could not find the relevant thread. Would be great if this info. was documented somewhere.

The texture memory used in Corona (and iOS and Android) is an umcompressed bitmap of the loaded image. Each pixel requires 32 bits (4 bytes): red, green, blue, and alpha channels. It doesn't matter if the image file was a jpg or png.

In your example of 1703 x 2505, the texture memory used will be larger than just multiplying the numbers because the values are rounded to the next higher power of two.

In your example, 1703 x 2505 is really 2048 x 4096 x 4, which is 33,554,432 bytes. This matches the number returned by system.getInfo( "textureMemoryUsed" ).

views:1341 update:2011/10/10 9:00:20
corona forums © 2003-2011