No longer able to render scene to BitmapData

Software: Away3D 4.x

Avatar
theMightyAtom, Sr. Member
Posted: 24 August 2011 08:49 PM   Total Posts: 669

Dear Devs,

Within the last month the function that allowed you access to context3D through RenderBase.as has been removed.

Adding the function again doesn’t appear to have any bad side effects and allows screen dumps of 3D content. Not sure whether if this is a bug or a fix for another bug?!

Missing:

public function get context() : Context3D
  {
   
return _context;
  

Cheers!

 

   

Richard Olsson, Administrator
Posted: 25 August 2011 06:45 AM   Total Posts: 1192   [ # 1 ]

Do you actually need access to the Context3D instance, or do you simply want to draw the rendered output to a bitmap data? If the latter, a better way will likely be to add a wrapper for that method straight to the View3D, so please let us know what you need.

   

Avatar
theMightyAtom, Sr. Member
Posted: 25 August 2011 10:10 AM   Total Posts: 669   [ # 2 ]

Hi Richard,

I suppose it doesn’t really matter as long as we can get to context3d.drawToBitmapData().

On the other hand one could argue it belongs on RenderBase, where the swapBackBuffer is, as you need to use these in conjunction with one another, and it’s where the _context proxy is, right?

Maybe there was a higher reasoning for removing access to it?

Cheers!

   

tomihr, Jr. Member
Posted: 08 September 2011 04:38 PM   Total Posts: 31   [ # 3 ]

Hello,
can you please explane or post some code of how are you doing this now, because adding the get context to RenderBase seams that don’t work.
Thanks

   

Avatar
theMightyAtom, Sr. Member
Posted: 08 September 2011 08:22 PM   Total Posts: 669   [ # 4 ]

I just tried googling through the source and the method doesn’t appear to be exposed (correct me if I’m wrong), but you can add it to RenderBase.
Remember to call swapBackBuffer = false and then render, before calling context3D.drawToBitmapData(bitmapDataToWriteTo);

I’ll try to post a full example when I get to work tomorrow smile

   

Avatar
Ringo Blanken, Administrator
Posted: 09 September 2011 06:48 AM   Total Posts: 120   [ # 5 ]

Try:

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

 Signature 

Freelancer: http://www.ringo.nl/en/
http://www.jiglibflash.com
http://www.awayphysics.com
http://www.away3d.com

   

tomihr, Jr. Member
Posted: 09 September 2011 08:31 AM   Total Posts: 31   [ # 6 ]

Thanks, it works fine now.

   

RIPI, Jr. Member
Posted: 24 October 2012 08:40 AM   Total Posts: 33   [ # 7 ]

Hi, i just downloaded the current version from the dev branch and it seems as if the swapBackBuffer property isn’t existing anymore!? How am i supposed to replace this statement? Thanks! wink

   

laurent, Newbie
Posted: 27 November 2012 04:21 PM   Total Posts: 29   [ # 8 ]

You can directly use the method queueSnapshot of RendererBase:

var data:BitmapData = new BitmapData(widthheightfalse);
view.renderer.queueSnapshot(data);
view.render(); 
   

relgycandy, Newbie
Posted: 04 March 2013 06:47 AM   Total Posts: 3   [ # 9 ]

You say it! I very much agree with your point of view!I hope to be able to see your published posts.

 

 

_____________________________________
wow gold|diablo 3 gold|wow gold kaufen|GW2 Gold

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X