Drawing Stage3D to a BitmapData?

Software: Away3D 4.x

loungelizard, Newbie
Posted: 27 February 2012 11:31 AM   Total Posts: 14

Is it possible? Or does Away3D provide a means to reach the Stage3D render buffer to draw it onto a BitmapData?

The reason is that I’m writing a screenshot util for AIR and when capturing the stage, any stage3D content is not captured since it’s not on the AS3 display list.

Please tell me there is a way to do that because if not that would suck immensely! o_O

   

loungelizard, Newbie
Posted: 27 February 2012 01:17 PM   Total Posts: 14   [ # 1 ]

Ok, a step further ... I’m trying to use

stage.stage3Ds[i].context3D.drawToBitmapData(image

But getting a

Exception fault: Error: Error #3692: All buffers need to be cleared every frame before drawing.
at flash.display3D::Context3D/drawToBitmapData()


I guess it’s better not to tamper with the buffer where Away3D should handle this stuff. Question is now whether Away3D has a way to draw the render buffers to bitmap?

   

loungelizard, Newbie
Posted: 01 March 2012 04:28 AM   Total Posts: 14   [ # 2 ]

*bump*

   

John Brookes, Moderator
Posted: 01 March 2012 05:34 AM   Total Posts: 732   [ # 3 ]

_view.renderer.swapBackBuffer = false;
_view.render();
_view.stage3DProxy.context3D.drawToBitmapData(bitmapHolder.bitmapData);
_view.renderer.swapBackBuffer = true;

   

loungelizard, Newbie
Posted: 02 March 2012 04:18 AM   Total Posts: 14   [ # 4 ]

That did the trick, thanks a lot John!

   

frukc, Newbie
Posted: 10 March 2012 12:02 AM   Total Posts: 8   [ # 5 ]

thnx!

   

Tayyab, Member
Posted: 16 October 2012 03:43 AM   Total Posts: 72   [ # 6 ]

can you please share the code. smile
how do i create the screenshot bitmapdata

   

Avatar
Baush, Sr. Member
Posted: 19 October 2012 09:47 PM   Total Posts: 135   [ # 7 ]

As this seems to be an often requested question, perhaps it would be useful to add a getBitmapData() method to the renderer class..

   

Mr Margaret Scratcher, Sr. Member
Posted: 19 February 2014 11:17 PM   Total Posts: 344   [ # 8 ]

In case anyone else is looking for this - it has now changed, actually a little more simple…

var stageBMD:BitmapData = new BitmapData(stage.stageWidthstage.stageHeight);
   var 
stageBitmap:Bitmap = new Bitmap(stageBMD);
   
view.renderer.queueSnapshot(stageBMD); 

smile

   

Mr Margaret Scratcher, Sr. Member
Posted: 25 February 2014 12:12 AM   Total Posts: 344   [ # 9 ]

Hmm, might have spoken too soon - I’m having difficulties posting this data onto anything else…

Weird bitmap data problem…

   

Francesco, Newbie
Posted: 24 January 2015 08:54 PM   Total Posts: 4   [ # 10 ]
John Brookes - 01 March 2012 05:34 AM

_view.renderer.swapBackBuffer = false;
_view.render();
_view.stage3DProxy.context3D.drawToBitmapData(bitmapHolder.bitmapData);
_view.renderer.swapBackBuffer = true;

I have this problem using your code:

1119: Access of possibly undefined property swapBackBuffer through a reference with static type away3d.core.render:RendererBase.

Any suggestion

   

rdoi, Member
Posted: 26 January 2015 05:38 PM   Total Posts: 86   [ # 11 ]

I think the method posted by Brookes (RIP) was deprecated.
In Away 4.1x, try using the one proposed by “@Mr Margaret Scratcher” 2 replies above yours.

   

Francesco, Newbie
Posted: 26 January 2015 05:42 PM   Total Posts: 4   [ # 12 ]

Thank… I have used that….

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X