Problems with Loading a Dae model's Texture

Hello again guys.



I have tried and tried figuring out of this, and i have decided to post again. I have imported my model, but the problem now is that there isnt any texture on the model, only colors. So anyone have any ideas that might help me ?



Thanks :slight_smile:



The following code is my application.



import com.jme.app.AbstractGame.ConfigShowMode;
import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingBox;
import com.jme.math.Vector3f;
import com.jme.scene.Node;
import com.jmex.model.collada.ColladaImporter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

public class Model extends SimpleGame  {

   
    protected void simpleInitGame() {

        playerModel();
        playerModel().setModelBound(new BoundingBox());
        playerModel().updateModelBound();
        playerModel().setLocalTranslation(new Vector3f(2,0,0));
        rootNode.attachChild(playerModel());
        rootNode.updateRenderState();

        rootNode.attachChild(playerModel());
        rootNode.updateRenderState();
    }


public static Node playerModel() { 

        InputStream source;

      try {
         source  = new FileInputStream("data/model/testmodels.dae");
      } catch (FileNotFoundException e) {
         throw new RuntimeException(e);
      }
       
      ColladaImporter.load(source,"data/model/testmodels.dae");

      return ColladaImporter.getModel();
   
         }
   
    public static void main(String[] args) throws Exception {

        Model app = new Model();

        app.setConfigShowMode(ConfigShowMode.AlwaysShow, Model.class.getClassLoader().getResource("Test"));
       
        app.start();
}
}



Here is the scene:

Set up the ResourceLocator with the path to your directory with the textures before loading the model.

Maybe it helps.





ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE,
                    new SimpleResourceLocator(Main.class.getClassLoader().getResource("com/bla/textures/")));