More Resizing Problems with Multiple Layers on stage3DProxy

Software: Away3D 4.x

BobWarfield, Newbie
Posted: 28 April 2014 10:17 PM   Total Posts: 19

Hello folks, I am looking for some help.  There’ve been a lot of messages about resizing issues when running multiple layers—I know, I’ve been through them all and tried everything suggested but no joy.

Here is how my app is supposed to look (screenshot running single layer):

http://www.cnccookbook.com/img/GWizardE/Probs/Away3DProblem2.jpg

FWIW, I want the grid in that image on the bottom layer and CADCAM renderings above it so the grid can never obscure them.

Now here is what I’m getting and the resize problem:

http://www.cnccookbook.com/img/GWizardE/Probs/Away3DProblem.jpg

Here is how the stage3DProxy is being initialized:

// Define a new Stage3DManager for the Stage3D objects
  stage3DManager = Stage3DManager.getInstance(myStage); 
 
  // Create a new Stage3D proxy to contain the separate views
  stage3DProxy = stage3DManager.getFreeStage3DProxy();
  stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATED, onContext3DCreate);
  context3DCreateInstalled = true;
 
  myStage.align = StageAlign.TOP_LEFT;
  myStage.scaleMode = StageScaleMode.NO_SCALE;
 
  stage3DProxy.antiAlias = SCENE_ANTI_ALIAS;
  stage3DProxy.color = SCENE_BACKGROUND_COLOR;
 
  stage3DProxy.x = this.x;
  stage3DProxy.y = this.y; 
  stage3DProxy.width = this.width;
  stage3DProxy.height = this.height;

“this” is a Sprite, BTW.  It is the container for the 3D views. 

Here is how the views get initialized:

  private function initView():View3D
  {
  // Setup the view
  var view:View3D = new View3D();
  view.stage3DProxy = stage3DProxy;
  view.shareContext = true;

  view.rightClickMenuEnabled = false;
 
  view.camera.lens.far = cameraViewDistance;
 
  view.antiAlias = SCENE_ANTI_ALIAS;
  view.x = 0;
  view.y = 0;
  view.width = this.width;  // Was 800
  view.height = this.height;  // Was 600
  addChild(view);
 
  // Get some handling in place to keep up with Stage3D falling over
  // installContext3DCreate( view );
 
  return view;
  }
 
Two views get created and are rendered thus:

  public function render():void
  {
  if (gridView) {
  stage3DProxy.clear();
  gridView.render();
  // Claimed to be a requirement in: http://away3d.com/forum/viewthread/4273/
  stage3DProxy.clearDepthBuffer();
  mainView.render();
  stage3DProxy.present();
 
  dumpSizes();
  } else {
  // this.dumpChildren();
  mainView.render();
  }
  }

BTW, if I don’t generate “gridView”, it all goes to one view, but still has this identical resizing problem.  Seems to be some function of the stage3DProxy.

Resizing is being called properly.  In fact, if I dump the size of every thing in site, it all shows up with the correct result.  Here is the function that does that:

  public function dumpSizes():void
  {
  log.debug( “this.x = ” + this.x + “, this.y = ” + this.y + “, this.width = ” + this.width + “, this.height = ” + this.height );
  log.debug( “stage3DProxy.x = ” + stage3DProxy.x + “, stage3DProxy.y = ” + stage3DProxy.y + “, stage3DProxy.width = ” + stage3DProxy.width + “, stage3DProxy.height = ” + stage3DProxy.height );
  log.debug( “gridView.x = ” + gridView.x + “, gridView.y = ” + gridView.y + “, gridView.width = ” + gridView.width + “, gridView.height = ” + gridView.height );
  log.debug( “mainView.x = ” + mainView.x + “, mainView.y = ” + mainView.y + “, mainView.width = ” + mainView.width + “, mainView.height = ” + mainView.height );
  log.debug( “myStage.x = ” + myStage.x + “, myStage.y = ” + myStage.y + “, myStage.width = ” + myStage.width + “, myStage.height = ” + myStage.height );
  if (this.stage) {
  log.debug( “stage.x = ” + stage.x + “, stage.y = ” + stage.y + “, stage.width = ” + stage.width + “, stage.height = ” + stage.height ); 
  }
  log.debug( “nativeWindow.width = ” + GWizSettings.docWindow.nativeWindow.width + “, nativeWindow.height = ” + GWizSettings.docWindow.nativeWindow.height );
  }
 
I can’t tell if it is being clipped to a smaller size, or scaled to a smaller size.  It seems more like the latter, even though I have set NO_SCALE.

Any ideas would be very much appreciated.

Best,

Bob Warfield

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X