Hi, guys.
I´m trying to render the scene to a texture and apply it to a TextureMaterial on a cube mesh;
my code:
cube = new Mesh(new CubeGeometry(150));
var stage3dManager : Stage3DManager = Stage3DManager.getInstance(stage);
var stage3dProxy:Stage3DProxy = stage3dManager.getStage3DProxy(0);
mat = new TextureMaterial();
var renderTexture : RenderTexture = new RenderTexture(512, 512);
texture = renderTexture.getTextureForStage3D(stage3dProxy);
mat.texture = renderTexture;
cube.material = mat;
cube.y = 300;
view.scene.addChild(cube);
var renderer : DefaultRenderer = new DefaultRenderer();
var entityCollector : EntityCollector = renderer.createEntityCollector();
entityCollector.clear();
entityCollector.camera = view.camera;
view.scene.traversePartitions(entityCollector);
renderer.render(entityCollector, texture);
entityCollector.cleanUp();
I´ve already imported the arcane namespace for get access to some of the functions above.
My render just shows the already constructed meshes plus a red, not textured, cube.
Thanks for any help.