BitmapData.draw() method can not draw view3d obj

Software: Away3D 4.x

Trigal, Newbie
Posted: 05 April 2012 01:06 AM   Total Posts: 2

I want to capture away3d’s screen into a picture.but the object3d view doesn’t show in the picture.
the method is

var bmp:BitmapData ImageSnapshot.captureBitmapData(component3d);//component3d extends UIComponent
img.source = new Bitmap(bmp);  //img is an <mx:Image> 

could somebody tell me why or show me an example?Thank you very much.

   

Avatar
kurono, Sr. Member
Posted: 05 April 2012 02:44 AM   Total Posts: 103   [ # 1 ]

Let’s the “view” is yours View3D.

var bmp:BitmapData = new BitmapData(view.width, view.height);
view.renderer.swapBackBuffer = false;
view.render();
view.stage3DProxy.context3D.drawToBitmapData(bmp);
view.renderer.swapBackBuffer = true;

img.source = new Bitmap(bmp);

   

Trigal, Newbie
Posted: 05 April 2012 06:03 AM   Total Posts: 2   [ # 2 ]

Thank you kurono, It works.
It’s hard to understand the core code without any docs,I’ll research these code.
Thanks again!

   

Guido, Member
Posted: 07 May 2012 01:10 PM   Total Posts: 70   [ # 3 ]

I needed this too and it really works, but there is one thing that doesn’t.

If I want to have it transparent, i have a black background instead. Perhaps thats why i have wmode direct instead of transparent.

But i can’t have two wmodes, so how can i make it transparent like in Away3D 3.6?

   

Guido, Member
Posted: 16 May 2012 08:26 AM   Total Posts: 70   [ # 4 ]

I have another problem. When i print the bitmapdata with a surrounding sprite and the PrintJob class i see only my backgroundcolor and the things i putted directly on stage (not stage3d) and if i render a few frames all is black but it all my meshes, materials and my hovercontroller are intact.

The line which causes this is:
this.myPrintJob.addPage(this.sprite, null, options);

this.sprite is a new instance of a sprite.

Why does this line affect stage3D or view3D or something that has to do with rendering 3D-stuff.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X