Bizarre problem with not being able to draw snapshotted stage3d bitmap data to anything…

Software: Away3D 4.x

Mr Margaret Scratcher, Sr. Member
Posted: 25 February 2014 12:10 AM   Total Posts: 344

After initial delight that snapshotting the bitmap data from a stage3d view is now really really easy, I’ve spent the last couple of days banging my head against a brick wall trying to use the bitmap data as the background for the view.

After getting nowhere, (always getting a white rectangle), tonight I decided to instead use the same code which I had used elsewhere to see what was going wrong…

So:

var stageBMD:BitmapData = new BitmapData(view.widthview.height);
   
view.renderer.queueSnapshot(stageBMD);
   
   var 
stageBitmap:Bitmap = new Bitmap(stageBMD);
   var 
stageMC:MovieClip = new MovieClip();

                       
//swapping these to test:
   
stageMC.addChild(stageBitmap);
   
//stageMC.addChild(defaultCase);
   
   
var targetHeight:int 256;
   var 
targetWidth:int 256;
   
   
stageMC.scaleX targetWidth stageMC.width;
   
stageMC.scaleY targetHeight stageMC.height;
   
   var 
scaledBMDBitmapData = new BitmapData(stageMC.width,stageMC.height);
   
   
addChild(stageMC);
   
scaledBMD.draw(stageMC);
   
   var 
scaledBM:Bitmap = new Bitmap(scaledBMD);
   
view.background = new BitmapTexture(scaledBMD); 

And weirdly, if I use the defaultCase bitmap, it works as expected, but if I try to use the stage bitmap, although I can add it to the stageMC (not necessary I know, but it was how my other code was working so I wanted to be sure), scale it, and add it to the stage, and it is visible as you’d expect, if I try to draw that stageMC into scaledBMD I just get a white rectangle…

Really confused :S

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X