ipad 1 and 2 only capable of displaying 1 stage3d layer?

Software: Away3D 4.x

thatflashdude, Newbie
Posted: 09 October 2012 05:08 PM   Total Posts: 19

has anyone else noticed that ipad only supports 1 level of stage 3d?

for example this always fails:
if (_stage.stage3Ds.length > 0) {
  trace (“i support more than 1 layer!”);
}

because of this limitation, i can not publish my app that uses starling and away3d.

is this perhaps a setting in the app descriptor file?

   

Avatar
Fabrice Closier, Administrator
Posted: 09 October 2012 06:52 PM   Total Posts: 1265   [ # 1 ]

Of course you can. You need to define a shared context environment, view.shareContext= true;. So that away3d layer renders first, then Starling or vice versa. Check the examples for the setups provided by both api’s.

Doing it by hand, your enterframe would look like this.
_stage3DProxy.clear(); 
_away.render();—> drawTriangle done, buffers cleared
_starling.render();—> drawTriangle
// may be insert here clear Starling buffers (I don’t know if the routine is done automatically in this api)
_stage3DProxy.present();

The stage3DProxy is also a view property.

   

thatflashdude, Newbie
Posted: 09 October 2012 07:02 PM   Total Posts: 19   [ # 2 ]

hi fabrice…thanks for all your inspiring work!

ive tried the sharedContext route…but i should have been more specific in that im not using starling but another away 3d view . i am implementing a split view panorma viewer where each view has a camera looking inside a 6 plane cube.

i have set up the code similar to the examples given. here is how i setup the views

  private function initStage3D1():void {
  // Define a new Stage3DManager for the Stage3D objects
  stage3DManager = Stage3DManager.getInstance(_stage);

  // Create a new Stage3D proxy to contain the separate views
  stage3DProxy = stage3DManager.getFreeStage3DProxy();
  //stage3DProxy.enableDepthAndStencil = true;
  stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATED, on_initStage3D1);
  stage3DProxy.antiAlias = 4;
  stage3DProxy.color = 0x0;
  }

  private function on_initStage3D1(event : *) : void {
  trace (“on_initStage3D1”);
  initView();
  initView2();
  initObjects();
  addListeners(); 
  }

 
  private function initView():void {
  scene = new Scene3D();
  view = new View3D(scene);
  view.shareContext = true;
  view.stage3DProxy = stage3DProxy;
  lens = new PerspectiveLens (lastFov);
  lastFov = lens.fieldOfView;
  view.camera.lens = lens;
  view.camera.y = 0;
  view.camera.z = -512;
  setViewSize (view, 1024, 382, 0, 0);
  _stage.addChild(view);
  }

  private function initView2():void {

  view2 = new View3D();
  view2.scene = scene;
  view2.stage3DProxy = stage3DProxy;
  lens = new PerspectiveLens (lastFov);
  lastFov = lens.fieldOfView;
  view2.camera.lens = lens;
  view2.camera.y = -2024;
  view2.camera.z = -512;
  setViewSize (view2, 1024, 382, 0, 386);
  _stage.addChild(view2);
  }

  private function onUpdate (event : Event) : void {
  var diffX:int, diffY:int;
  var cameraSpeed : Number = 0.175;
  stage3DProxy.clear();
  if (view) {
  if (isMove) {
    diffX = (cameraSpeed * (stage.mouseX - lastMouseX))*-1;
    diffY = (cameraSpeed * (stage.mouseY - lastMouseY)) * -1;
    //view.camera.
    dragController.panAngle = diffX + lastPanAngle;
    dragController.tiltAngle = diffY + lastTiltAngle;   
  }
  view.render();
  }
  if (view2) {
  if (isMove) {
    diffX = (cameraSpeed * (stage.mouseX - lastMouseX))*-1;
    diffY = (cameraSpeed * (stage.mouseY - lastMouseY)) * -1;
    //view.camera.
    dragController2.panAngle = diffX + lastPanAngle;
    dragController2.tiltAngle = diffY + lastTiltAngle;   
  }
  view2.render();
  }
 
  stage3DProxy.present();
  }


this code kills it even on the desktop:
  view2.stage3DProxy = stage3DProxy;

and even with that removed, it only displays one view

   

Avatar
Fabrice Closier, Administrator
Posted: 09 October 2012 07:45 PM   Total Posts: 1265   [ # 3 ]

for the sake of test, ensure that the manager returns you the same context. stage3ds[0]. If you set Debug to true, what are the errors?

also, why not using the two cameras/one view?

 

   

thatflashdude, Newbie
Posted: 09 October 2012 09:00 PM   Total Posts: 19   [ # 4 ]
Fabrice Closier - 09 October 2012 07:45 PM

for the sake of test, ensure that the manager returns you the same context. stage3ds[0]. If you set Debug to true, what are the errors?

also, why not using the two cameras/one view?

hey..great tip..ill restrict myself to one view and multiple cameras. im a new to away and 3d in general. thanks!

   

thatflashdude, Newbie
Posted: 10 October 2012 01:38 AM   Total Posts: 19   [ # 5 ]

fabrice - ive googled around but i cant seem to understand how to have two cameras in one view. i need to be able to project two seperate views of the same scene..but without using two views.

what did you mean by multiple cameras in one view. isnt it true that only one camera can occupy the view port. it seems only multiple views would allow more than one rendering of a scene

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X