Scene only render if i mouseover a mesh (the context is shared with starling)

Software: Away3D 4.x

alxs, Newbie
Posted: 06 July 2014 10:04 PM   Total Posts: 4

I followed the tutorial for rendering starling o top of away3D and all is working fine but now the scene only render if i mouse over a mesh, otherwise is just a white screen.

With mouse out the plane:
http://i.imgur.com/kEP13Oo.png
With mouse over the plane:
http://i.imgur.com/YLWU8gE.png

Here is my code (just boilerplate and a plane)

public class Main extends Sprite
 {
  
  
private var view3D:View3D;
  private var 
stage3DManager:Stage3DManager;
  private var 
stage3DProxy:Stage3DProxy;
  
  public function 
Main():void
  {
   
if (stage)
    
init();
   else
    
addEventListener(Event.ADDED_TO_STAGEinit);
  
}
  
  
private function init(e:Event null):void
  {
   removeEventListener
(Event.ADDED_TO_STAGEinit);
   
addEventListener(Event.ENTER_FRAME_onEnterFrame);
   
// entry point
   
   
view3D = new View3D();
   
   
initProxies();
  
}
  
  
private function initProxies():void
  {
   stage3DManager 
Stage3DManager.getInstance(stage);
   
   
stage3DProxy stage3DManager.getFreeStage3DProxy();
   
stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATEDonContextCreated);
  
}
  
  
private function onContextCreated(event:Stage3DEvent):void
  {
   initAway3D
();
   
initStarling();

   
view3D.scene.addChild(new Mesh(new PlaneGeometry(600400), new ColorMaterial(0x530000)));
  
  
}
  
  
private function initAway3D():void
  {
   
   view3D
.stage3DProxy stage3DProxy;
   
view3D.shareContext true;
   
   
addChild(view3D);
   
   
view3D.mousePicker PickingType.SHADER;
   
   
view3D.camera = new Camera3D(new OrthographicLens());
   
view3D.camera.1000;
   
view3D.camera.1000;
   
view3D.camera.1000;
   
view3D.camera.lookAt(new Vector3D(000));
  
}
  
  
private function initStarling():void
  {
   
var starling:Starling = new Starling(StarlingSpritestagestage3DProxy.viewPortstage3DProxy.stage3D);
  
}
  
  
private function _onEnterFrame(e:Event):void
  {
   stage3DProxy
.clear();
   
   
view3D.render();
   
   
stage3DProxy.present();
  
}
 
 }

If i change

view3D.mousePicker PickingType.SHADER

to raycast it works, but i need the PickingType to be shader.

EDIT: sorry for the duplicates, i guess the preview button also post.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X