Im working on a multiplayergame, so i need to add a new avatar model each time a user logs on the game.
But im having a problem, models loaded after the initGame looks like this:
look at the third guy:
http://img406.imageshack.us/my.php?image=screensm0.jpg
Some one could help?
looks like you are missing an updateRenderState maybe
It fixes the texture problem, but causes 3 new weird problems.
Now the model is drawed in front of objects that are behind him, the illumination looks weird and sometimes it blinks.
If I load the same mode, on the same way before initGame he looks perfect.
any idea?
make sure you have a enabled ZBUfferState
Im using it
ZBufferState buf = display.getRenderer().createZBufferState();
buf.setEnabled(true);
buf.setFunction(ZBufferState.CF_LEQUAL);
Any other idea?
When I set the Zbuffer for each model it works, tnx!
Just one problem missing, the blinkā¦ any idea?
make sure you update render states AFTER you've attached the model to your scene. Especially if you have render states setup on the scene that you want the model to inherit.
Yes, im doing it after attach
scene.attachChild(agent);
scene.updateGeometricState(0, true);
model.setRenderState(display.getRenderer().createZBufferState());
model.updateRenderState();
any other idea?
blinking says to me that you have state bleeding from some other part of your scene that was not updated properly.
To be honest, it's not cleat to me what all those updates does and when I should call them, I'm just programming based on the examples.
only the root node, or the scene node where you attach your models to, needs to have a ZBufferstate.
All child nodes which you attach to the scene node, will inherit this ZBufferstate.
I usually call updateRenderstate on the root node after i add something to the scene.
scene.attachChild(agent);
scene.updateGeometricState(0, true);
scene.updateRenderState();