exception; Invalid bitmapData! Must be power of 2 and not exceeding 2048

Software: Away3D 4.x

Manuel L., Member
Posted: 19 March 2012 07:41 AM   Total Posts: 99   [ # 16 ]

hey, one question for better understanding…
does this code do, that i can render my textures as usual, fitting to the object?

for example, i have a plane thats 300x467, so i apply a texture that is 300x467 and i call the auteresizebitmapdata, it works, cause it automatically resize to the next power of two?

that would be great ^^

   

Mar, Newbie
Posted: 08 May 2013 03:42 PM   Total Posts: 29   [ # 17 ]

Hi, I could use some help here. I had the same error problem as nohappy, and I copied JohnBrookes coding:

“private function autoResizeBitmapData(bmData: BitmapData, smoothing:Boolean = true): BitmapData
      {
        if (TextureUtils.isBitmapDataValid(bmData))
        return bmData;

        var max:Number = Math.max(bmData.width, bmData.height);
        max = TextureUtils.getBestPowerOf2(max);
        var mat:Matrix = new Matrix();
        mat.scale(max/bmData.width, max/bmData.height);
        var bmd:BitmapData = new BitmapData(max, max);
        bmd.draw(bmData, mat, null, null, null, smoothing);
        return bmd;
      }”

The thing is that I still get some errors:
1046 Type was not found or was not a compile-time constant: Matrix.
1180 Call to a possibly undefined method Matrix.

I’ve been looking for Matrix in my Away3D sources to import it but I wasn’t able to find it, could somebody help me please? I’m new at this and know just a lil as. Thanks

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X