i'm loading a model in md2 format, this model(a dwarf) have 2 two jpeg file with the textures, one for his axe a other for his body, i would like to know if there is any way to load these 2 files.i'm loading this way:
protected void simpleInitGame() {
URL textu=TestMd2Cat.class.getClassLoader().getResource("data/model/dwarf.jpg");
TextureState ts = display.getRenderer().createTextureState();
ts.setEnabled(true);
ts.setTexture(TextureManager.loadTexture(textu,Texture.MM_LINEAR_LINEAR,Texture.FM_LINEAR));
freakmd2.setRenderState(ts);
}
if some one knows how to load 2 textures for the same model help me please. thks
You have to get the child and apply the axe texture to that.
dwarf.getChild("axe").setRenderState(axeTextureState)
humm…i'm not sure if that is gonna work because the axe and the dwarf are not separated they on the same model.but thanks for the reply.
You can have more than one texture per mesh (multitexturing), assuming your tex-coords are able to deal with this appropriately.
one thing i forgot to say is that when i try to do the multitexture like that:
TextureState ts = display.getRenderer().createTextureState();
ts.setEnabled(true);
ts.setTexture(TextureManager.loadTexture(textu,Texture.MM_LINEAR_LINEAR,Texture.FM_LINEAR),0);
ts.setTexture(TextureManager.loadTexture(textu2,Texture.MM_LINEAR_LINEAR,Texture.FM_LINEAR),1); --> 2nd texture
the model gets all black, its still there moving but completely black.
at least someone knows if that i'm trying to do is possible in jmonkey???