Render Bitmap with multiple views

Software: Away3D 4.x

Beek, Member
Posted: 03 March 2015 11:56 PM   Total Posts: 67

Hi,

I’m attempting to render a bitmap using Stage3dProxy with multiple views.

view.renderer.queueSnapshot(bm

Works fine without a stage3Dproxy, however with a proxy it doesn’t render anything until the proxy is removed, and the normal rendering loop is called.

I’ve seen this
https://github.com/away3d/away3d-core-fp11/issues/714

Which appears to be a new bug,  and I’ve tried to fix it by implementing the queueSnapshot procedure in Stage3DProxy.as, as described,  by adding

if (_snapshotRequired && _snapshotBitmapData)
   
{
         _context3D
.drawToBitmapData(_snapshotBitmapData);
    
_snapshotRequired false;
   

into the onEnterFrame loop,

however it’s just rendering an empty bitmap.

Has anyone any idea how to render a bitmap with stage3dproxy?

 

   

Beek, Member
Posted: 04 March 2015 04:23 AM   Total Posts: 67   [ # 1 ]

I’m close with 2 attempts:

This is 2 views for side by side VR.

1. Remove SharedContext, render and put it back

view.shareContext false;
     
view.render();
     
transitionBitmap.bitmapData bitmapData;
     
transitionBitmap.bitmapData.merge(bitmapData, new Rectangle(0,0,width/2height),new Point(width/2,0),256256256256);
     
stage3DProxy.clear();
     
view.shareContext true

This generates the image, but when the loading is done and the image is taken away, the right hand view is white, and it won’t come back unless I reinitialize the side by side view, which is expensive.


2. using the fix suggested on github, by editing Stage3dProxy

var bm:BitmapData = new BitmapData(width/2heightfalse,0xffff90);
         
view.render();
      
view.stage3DProxy.addEventListener("snapshotReady", function(){
       transitionBitmap
.bitmapData bm;
          
transitionBitmap.bitmapData.merge(bitmapData, new Rectangle(0,0,width/2height),new Point(width/2,0),256256256256);
       
transitionBitmap.blurSlowly(0.2);
      
});
      
view.stage3DProxy.queueSnapshot(bm);
      
view.render(); 

And adding the function to the render loop

if (_snapshotRequired && _snapshotBitmapData)
   
{
    _context3D
.drawToBitmapData(_snapshotBitmapData);
    
_snapshotRequired false;
    
dispatchEvent(new Event("snapshotReady"));
   

This seems to work, however the captured bitmap is black, but it doesn’t destroy the side by side view.

Anyone any ideas!?

   

JaykopX, Newbie
Posted: 04 March 2015 09:32 AM   Total Posts: 13   [ # 2 ]

Hi!
I’m not an expert but the order of your clear(), render() and present() calls looked flawed.
it should be something like that:

//Prepare Stage3D for render operations
   
stage3DProxy.clear();   
   
   
//Render all views
   
view.render();   
   
iinterfaceView.render();
   
   
//Present everything
   
stage3DProxy.present(); 
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X