Textures change during execution

Hello,



I’m quite new at JMonkey and I’m having some problems when loading my models made with Blender.

I have some textured models and I am able to load them into JMonkey properly.



However, when I execute the game, the textures of the models are correct only if I attach the node containing the model to the rootNode in the initizialization methods (initSystem(), initGame()). If I attach the objects containing the models in execution time (in the update() methods) the textures are always changed and the models take the textures from the other spatials of the scene. Then, sometimes when another object is attached the textures of the previously attached models change for the textures of the new one.



This doesn’t happen when the objects are attached in the initialization methods and I can’t find the problem. I’m not applying any TextureState directly to the rootNode.



I hope I explained myself properly.



Thank you!

I guess you mess that up in your own code. The described functionality works as it should, read through the tutorials to really understand how jME works.

Thank you for your answer normen.



I have tried to include an updateRenderState() after attaching each of the objects to the main node and the problem seems to be solved.

I don’t really understand why it wasn’t working before since I had already included a line like this at the end of the update method:



[java]rootNode.updateRenderState()[/java]



I thought this should update the state of all the children of rootNode, but it may work in anohter way.



Thanks for developing JMonkey engine, it is a great help in game creation.



Regards.

Oh, you are using jME2. Yeah, that requires you to update all kinds of things all the time… I really suggest going for jME3 directly.

Yes, sorry I forgot to specify that I am using JME2. I will be using JME3 for sure in my next projec, but I tried to change my current project and it seems to need a lot of changes, so I’m going to finish it this way. Thank you!

I would recommend to switch to jME3.



I myself worked with jME2 until some weeks ago. Then i just tried out jME3 and loved it. :wink: It makes your life so much easier and provides you with everything you need.

The portation may be a bit annoying and take its time, but its worth it.

I am using Jmonkey for the first time for a project at college, and I first discover version 2. Later on, I tried to move to jME3 because of some features that I wanted to include, but I found it quite annoying, as you have said :slight_smile: Now, I’m just about to finish my project and I don’t have time to switch, since the deadline is near.

However, I will use jME3 for sure in my next projects :slight_smile: