Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: missingno on October 11, 2013, 10:16:58 AM
-
Why are atlas sizes only specific sizes ?
For example: a 1024 x 1024 will immediately jump to 1024 x 2048 if I add one tiny sprite to a completely full 1024 x 1024. I don't understand the reasoning behind this, as automatically increasing it that much vs just increasing the size enough to hold the new sprite creates a huge amount of wasted space and memory.
I am running into this problem and it's causing my game to crash on the iPod Touch 4 when if the atlases were sized just enough to fit the sprites in them I would have memory to spare.
Can anyone explain this to me ?
Thanks.
-
Each sprite needs a 1 pixel border in the atlas, so if you add something that's 1024 pixels high or wide, it needs the next power of two which is 2048.
If they're that big, consider using them in a UITexture instead of the atlas.
-
I think I explained what I was looking for wrong. I mean my atlas (all my sprites) is 1024x1024 and is completely full. How come if I were to add a 20x20 sprite the atlas would jump to 1024x2048 and not something like 1024x1046 ?
it needs the next power of two.
Why is that, if it only needs a single pixel border why allocate an extra 1022 ?
-
Because of the way graphics cards work. :)
http://gamedev.stackexchange.com/questions/26187/why-are-textures-always-square-powers-of-two-what-if-they-arent