Multiple view port working?

Software: Away3D 4.x

forest, Newbie
Posted: 06 August 2014 05:34 PM   Total Posts: 6

Hi there.

I’m testing en example with four view ports of the same scene:
http://www.flashmagazine.com/tutorials/detail/away3d_4_basics_-_the_view_and_the_scene/

on a Galaxy Note2. Only the top left view port shows.

All four view ports show on desktop

Please help

Thanks

   

rdoi, Member
Posted: 29 September 2014 06:21 PM   Total Posts: 86   [ # 1 ]

Mobiles doesn’t support multiple Stage3D, so you have to render all views to the same Stage3D using a proxy.

Take a look in the Stage3DProxy class and the use in the docs.

So you may change the view instances with:

view.shareContext= true;
view.stage3DProxy= yourStage3DProxy;

   

forest, Newbie
Posted: 30 September 2014 02:58 AM   Total Posts: 6   [ # 2 ]

Thanks. I tried the sharedContext but had quite a few roadblocks few weeks ago:

1) picking throws exception
2) I setup context3d.setRenderToTexture() to some texture. But view.render() eventually sets render target to the default back buffer again.

And frankly, I don’t know how to correctly replicate Opengl’s glViewPort() in stage3d. For stereo rendering, I did something akin to

context3d.configureBackBuffer( myStage.stageWidth/2, myStage.stageHeight);
myStage.x=0;
view.render();
myStage.x = myStage.stageWidth/2;
view.render();

But only one view.render() call produces visible results.

   

rdoi, Member
Posted: 30 September 2014 05:17 PM   Total Posts: 86   [ # 3 ]

I’m not sure if I understand your intention on dealing with the renderToTexture and the backbuffer.

Anyway, if you intent to render multiple views/scenes, you need multiple views instances, all sharing the same Stage3D (and its backbuffer, etc).

So just create 2 view3d instances, share the same proxy, and place them side-by-side in the flash stage. In the proxy enterframe, just render both.

The stage3D is like an empty canvas, where you just go rendering things layer by layer.

Here is a little test:

package {
 import away3d
.containers.View3D;
 
import away3d.core.managers.Stage3DManager;
 
import away3d.core.managers.Stage3DProxy;
 
import away3d.events.Stage3DEvent;
 
import away3d.primitives.WireframeCube;
 
import away3d.primitives.WireframePrimitiveBase;
 
import away3d.primitives.WireframeTetrahedron;

 
import flash.display.Sprite;
 
import flash.display.StageAlign;
 
import flash.display.StageScaleMode;
 
import flash.events.Event;

 
[SWF(backgroundColor="#0055aa"frameRate="30"width="1024"height="720")]
 
public class MultiViewTester extends Sprite {
  
private var leftView View3D;
  private var 
rightView View3D;
  private var 
stage3DProxy Stage3DProxy;
  private const 
cube WireframePrimitiveBase= new WireframeCube(100,100,100,0xff0000);
  private const 
tetra WireframePrimitiveBase= new WireframeTetrahedron(100,100,0x00ff00);

  
// Construtor
  
public function MultiViewTester() {
   stage
.align StageAlign.TOP_LEFT;
   
stage.scaleMode StageScaleMode.NO_SCALE;

   var 
stage3DManager Stage3DManager Stage3DManager.getInstance(stage);
   
stage3DProxy stage3DManager.getFreeStage3DProxy();
   
stage3DProxy.color0x004080;
   
stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATEDonContextCreated);
  
}

  
private function onContextCreated(event Stage3DEvent) : void {
   leftView
= new View3D();
   
leftView.shareContext true;
   
leftView.stage3DProxy stage3DProxy;
   
leftView.widthstage.stageWidth .5;
   
leftView.scene.addChild(cube);
   
addChild(leftView);

   
rightView= new View3D();
   
rightView.shareContext true;
   
rightView.stage3DProxy stage3DProxy;
   
rightView.xrightView.widthstage.stageWidth .5;
   
rightView.scene.addChild(tetra);
   
addChild(rightView);

   
stage3DProxy.addEventListener(Event.ENTER_FRAMEonFrame);
  
}

  
private function onFrame(event Event) : void {
   cube
.rotationX+= 2;
   
cube.rotationZ-= 2
   
tetra.rotationX-= 2;
   
tetra.rotationY+= 2;

   
leftView.render();
   
rightView.render();
  
}
    
 }

 

 

   

Beek, Member
Posted: 21 February 2015 10:50 PM   Total Posts: 67   [ # 4 ]

Any idea how to apply a filter to each side without it making the sides fullscreen?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X