Hi all,
I’m trying to share the context with starling. The view works fine, but when I write those two lines:
m_view.stage3DProxy = stage3DProxy;
m_view.shareContext = true;
The view disappears.
Here is my init code:
public function addView(ev:Event=null):void
{
removeEventListener(Event.ADDED_TO_STAGE, addView);
if (!isStage3DAndContextAvailable()){ return; }
//m_camera.lens.far = 50000;
stage3DManager = Stage3DManager.getInstance( stage);
// Create a new Stage3D proxy to contain the separate views
stage3DProxy = stage3DManager.getFreeStage3DProxy();
stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATED, init);
stage3DProxy.antiAlias = 3;
stage3DProxy.color = 0x0000FF;
}
public function init(event : Stage3DEvent):void
{
m_view = new View3D();
setCamera(-4.98, -0.20, -38, 29);
m_view.width = 640;
m_view.height = 480;
m_view.antiAlias = 3;
m_view.backgroundColor= 0x333333;
// Debug background
// graphics.beginFill(0xCCCCCC, 0.2);
// graphics.drawRect(0, 0, viewportWidth, viewportHeight);
// graphics.endFill();
addChild(m_view);
}