- Home /
using non-square textures on iphone
EDIT reformulated question to better express what I want to know:
I need to use uncompressed (16bit RGBA) textures for the HUD and as we're running out of space on our square texture. I was wondering if there was an extra performance penalty in using non-squared, uncompressed textures versus squared uncompressed textures. And if not, it still matter if texture is power of 2 sized?
Thanks, Jaap
Answer by Jaap Kreijkamp · Dec 15, 2009 at 11:09 PM
I've been looking around on the internet as I still haven't gotten a solid answer (sorry equals, thanks for answering but you're a bit vague, stating that there should be no difference and then that you don't get the full benefits of square en po2). What I've found is that when working with uncompressed textures:
- Non-square textures aren't a problem or a performance overhead versus squared.
- Sizes should still be power of 2.
Answer by equalsequals · Dec 09, 2009 at 04:38 PM
In short, HUD elements should not be compressed.
PVRTC is good for textures and "real world" images, not for vector or something that needs to appear sharp and crisp.
There is obviously going to be some penalty because you are keeping raw uncompressed bitmap data in memory.
In a game we released, we had several 480x320 uncompressed textures for menu screens. We also had several smaller non-power-of-two images for elements as well.
The key here is to only use as much as you need, when you need it. This might mean loading in some stuff from Resources at run-time and then destroying them and enabling them for collection during GC passes.
Hope that helps,
==
Thanks for your answer. I know there's a big penalty difference between compressed and uncompressed but I wanted to know if there's a penalty difference between uncompressed square and uncompressed non-square. We don't have a lot of performance to waste unfortunately.
Uncompressed is uncompressed, no matter how you spin it. There should be no difference.
In order to take advantage of PVRTC an image must be power-of-two. If your image is 1024x128 it is po2 but, in my understanding, does not get the full benefits of being square and po2.
Answer by Rj · Apr 21, 2010 at 08:53 AM
I haven't yet confirmed this personally but in this forum post, killarkai from RedRocket suggests that peak memory usage (on load) is reduced when using square textures (although long-run usage would appear to be the same). This is only important when you're hitting the top of your memory budget but it can be a very significant difference.