[Blender3D, jme xml exporter, textures] My model keeps grey


I try to import a model from blender. I tried .3ds, .obj and the jme xml exporter, but the model keeps grey, I never have any textures.

There were many tips in the forum and the tutorials:


http://www.jmonkeyengine.com/jmeforum/index.php?topic=3912.0 (so I followed the tutorial http://de.wikibooks.org/wiki/Blender_Dokumentation:_UV-Mapping

so where are the textures? the archive doesn't contain any file named dose.tgaCylinder.tga

I get it for obj-files.

There are some points I missed.

On first, this is the new code:

— begin —

ObjToJme maxtojme = new ObjToJme();

Node node = null; // Where to dump mesh.

ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();

URL url = TestSphere.class.getClassLoader().getResource("cats/dose.obj");

URL mtl = TestSphere.class.getClassLoader().getResource("cats/");

maxtojme.setProperty("mtllib", mtl);

maxtojme.convert(url.openStream(), bytearrayoutputstream);

JmeBinaryReader jmebinaryreader = new JmeBinaryReader();

jmebinaryreader.setProperty("texurl", mtl);

node = jmebinaryreader.loadBinaryFormat(new ByteArrayInputStream(bytearrayoutputstream.toByteArray()));

Vector3f goal = new Vector3f(20, 5, 25);



— end —

Two lines was missing:

maxtojme.setProperty("mtllib", mtl);

jmebinaryreader.setProperty("texurl", mtl);

And to avoid a bug, put mesh and texture files in a folder, not in the root dir of the classpath.