Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
How to change the texture with coding (without loading texture from disk )? I use this command: ccbSetSceneNodeMaterialProperty (node, 0, "Texture1", "example.jpg"); But it gives an error: could not open file |
||||
|
you need a tex library in your scene, some simple mesh that holds extra needed textures then you can easily swap textures between nodes etc. |
||||
|
Thankful . I did that. I mean, my textures are exist in scene . But I still get the same error and could not open file!! |
||||
|
first you get the terxture from your libray: in a for loop or so to get them all in a array variable for (i=0; i<texCount; i++) { var s = ccbGetSceneNodeFromName("cubeMesh1"); var myTex[i] = ccbGetSceneNodeProperty(s, "Texture"); } then you set the materialproperty with that variabe: ccbSetSceneNodeProperty(s, "Texture", myTex[i]); it depends on you mesh type that you must use: ccb Get / Set SceneNodeProperty or ccb Get / Set SceneNodeMaterialProperty |
||||
|
Thank you very much It works. I did not know before that we have to get the material first. Thank you again |
|