Texture is not setup with Power of 2. How to do so?

Hey! I am currently working on a Sprite Based game with the 2D Toolkit.
After I imported my sprites some of them are stretched and looked like this:

alt text

but the original image is this:

alt text

so, when I set the texture type from “Texture” to “Advanced” and then “Non power of 2” to “None” it looks right.
The image has a sice of 388x308 so i think the texture is dividable by 4 so its okay, right? Or did a red something wrong about how power of 2 is defined?

So, my question(s) are:

  1. how should i set up my texture that it has a power of 2?
  2. Or/And: is it even important that the texture has a power of two? Target platform should be iOS(iphone 4+ and Ipad 3+… so retina stuff)

thanks in advance :slight_smile:

Your definition of “power of 2” is off, that’s all.

Powers of 2 are defined as 2^n.
So: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, etc.

Basically start with 2 and multiply by 2, keep multiplying the answer by 2 and those are your Power of 2 magic numbers.

They are basically texture sizes that can fit into neat chunks of binary memory for better performance and optimised memory usage.

They should also be square for best performance but I imagine sticking to the magic numbers if fine [citation needed :P]

In a nutshell, textures are best exported in Po2 sizes for best performance but if you really had to do it in something else, I wouldn’t worry a lot.

Power of 2 is something different than you think.

2^1 = 2 2
2^2 = 4 22
2^3 = 8 2
22
2^4 = 16 2
222
etc.

so the 2 power of 2’s around your image size would be 256 and 512.

Then again if u set the texture type to GUI and not to texture then it will be just fine anyway.