Invalid bitmapData: Width and height must be power of 2 and cannot exceed 2048

Software: Away3D 4.x

Gio, Newbie
Posted: 03 July 2012 03:33 PM   Total Posts: 5

Hi.
So is there any way to use textures that are not power of 2 in width or height in Away3D 4? Could anyone please help me do that?
Thanks in advance,
Gio

   

Richard Olsson, Administrator
Posted: 03 July 2012 07:30 PM   Total Posts: 1192   [ # 1 ]

The short answer is no. You can’t use a texture that is power of 2 in width and height. Additionally, if you want to use mipmapping (on by default) the texture also has to be square.

However, you can of course change your textures at runtime to match these restrictions. To do this, you can use for example the TextureUtils class to figure out the most suitable new dimensions, and then just resize your BitmapData by creating a new one and drawing the old one onto the new one with a matrix to scale it up to match.

   

Gio, Newbie
Posted: 03 July 2012 07:33 PM   Total Posts: 5   [ # 2 ]

Thanks for your reply. I doubt this has to do something with that compressing algorithm which only works for the sizes that are power of 2. Thanks for the tip about the TextureUtils class though. Didn’t know it existed.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X