Objects have white letter texture

Hello again,



i have a new problem and its very mysterious.  :expressionless:



The thing is: i create Objects on my terrain by click.



The same function is once called on startup and on every click.



When its called on startup it works correctly (green brown thing on the right)

-> http://i45.tinypic.com/34zeib6.jpg



But when its called by click, then the texture/render mode is somehow wrong.

-> http://i47.tinypic.com/2v8mhk9.jpg



I tried to refresh texturestate, renderstate and cullstate of created object and rootNode but this didnt solve my problem.



Code from on-click-creating:


   Node node = PuffelManager.createRandomSmallTree(new Vector3f(0,-2,0));
   node.updateWorldBound();
   node.setLocalTranslation(new Vector3f(pos.getX(), pos.getY(), pos.getZ()));
   rootNode.attachChild(node);



Code from startup-call:


   Node node = PuffelManager.createRandomSmallTree(new Vector3f(0,-10,0));
   node.updateWorldBound();
   node.setLocalTranslation(new Vector3f(250.0f+i, 0, 250.0f+j));
   node.updateWorldBound();
   rootNode.attachChild(node);



Thanks  :?

do you use more than one thread? like swing event manager one ect. ?

Well i have an UI-Thread, but tried without it and the same problem occurs  :expressionless:

you are probably missing a node.updateRenderstate(), its a very common pitfall when creating objects on the fly.



try this:


.....
rootNode.attachChild(node);
node.updateRenderState();



It works at the startup, because at the the end of initGame() (depends on what game implementation you use), updateRenderstate() is called for you on the root node already.

Omg i love you  :D



Edit: http://i49.tinypic.com/330vay9.jpg



hoorrraay Object creating

looks interesting :slight_smile: