Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperLicht
Can't Change Texture When Loading A Compile CCBJS

joel-few-io
Registered User
Quote
2015-05-22 17:57:07

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



niko
Moderator
Quote
2015-05-23 05:30:22

Maybe you have some animation or behavior which is setting the texture or material back somewhere else? Otherwise, your code should work.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Inter?ational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact