Problem with xfrog plants

Hi,



I'm french (and noob), sorry for my english.



I tried to import xfrog plants (some tests here: http://web.inf.tu-dresden.de/ST2/cg/downloads/publicplants/) in my JME scene in .obj format, so I use JME ojb loader (like in tests packages), but I always encounter the same bug:



java.lang.NullPointerException

        at com.jme.util.TextureManager.loadImage(Unknown Source)

        at com.jme.util.TextureManager.loadImage(Unknown Source)

        at com.jme.util.TextureManager.loadTexture(Unknown Source)

        at com.jme.util.TextureManager.loadTexture(Unknown Source)

        at com.jmex.model.XMLparser.JmeBinaryReader.buildTexture(Unknown Source)

        at com.jmex.model.XMLparser.JmeBinaryReader.readBegining(Unknown Source)

        at com.jmex.model.XMLparser.JmeBinaryReader.loadBinaryFormat(Unknown Source)

        at com.jmex.model.XMLparser.JmeBinaryReader.loadBinaryFormat(Unknown Source)



I don't know if it's a JME problem or Xfog .obj format.



My code (very basic):



private void loadObj() {

        ObjToJme converter=new ObjToJme();

        try {

            URL objFile=Model.class.getClassLoader().getResource("data/model/mymodel.obj");

            URL texDir=Model.class.getClassLoader().getResource("data/model/");

            converter.setProperty("mtllib",objFile);

            ByteArrayOutputStream BO=new ByteArrayOutputStream();

            converter.convert(objFile.openStream(),BO);

            JmeBinaryReader jbr=new JmeBinaryReader();

            jbr.setProperty("texurl",texDir);

            Node r=jbr.loadBinaryFormat(new ByteArrayInputStream(BO.toByteArray())); <-- here the line raising the exception

            r.setLocalScale(10f);

            attachChild®;

        } catch (IOException e) {

            e.printStackTrace();

        }

    }



When I import these models with Blender or 3DSMax, it works correctly, if I re-export them without textures, it works properly in JME, so I think textures loading is the problem.



Thanks for any help.

Resolved



I found the problem: textures were in ".tif" format, it doesn't seem to work with ImageIO.read(…)

With .png no problems anymore.



JME is a great engine, thanks for your job.

Congrats on getting it working yourself. :slight_smile:



darkfrog