I'm loading the engine from a CCBJS file, created by a colleague:
var engine = startCopperLichtFromFile('3darea', '../coppercube/test.ccbjs');
I am able to successfully get the mesh node from the scene, but the texture in the WebGL view does not change:
engine.ingComplete = function() { var scene = engine.getScene();
sceneBillboard = scene.getSceneNodeFromName('myObject'); //type is MeshSceneNode
sceneBillboard.getMaterial(0).Tex1 = engine.getTextureManager().getTexture('../path/to/myTexture.png', true);
}
I'm also trying to update the texture at every frame of a video feed, and I notice that inside of my draw loop, the texture I assign is getting reset:
// runs every frame of the web cam video function processFrame(){
console.log( window.sceneBillboard.getMaterial(0).Tex1.Name ); // "theOriginalTextureSetInCopperCube.png"
sceneBillboard.getMaterial(0).Tex1 = engine.getTextureManager().getTexture('../path/to/myTexture.png', true);
console.log( window.sceneBillboard.getMaterial(0).Tex1.Name ); // "myTexture.png"
} // end of loop
|