I'm having problems getting a .obj model to load from a file. Whenever the model added to the scene, the screen won't display anything except for the background color. I copied the code from the HelloModelLoading tutorial (into a FixedLogicrateGame), but the copied code doesn't work, even though the tutorial itself does. I think that the model is imported and converted correctly, it seems to be that the model can't render correctly.
Here's the code that loads the model:
URL whiteboardURL = null;
try
{
File f = new File("resources\game\main_menu\whiteboard_bak.obj");
whiteboardURL = new URL("file:/" + f.getAbsolutePath());
}
catch(Exception e)
{
System.err.println("Failed to load main menu whiteboard model at location "resources\game\main_menu\whiteboard_bak.obj." (Wavefront .obj model)");
e.printStackTrace();
whiteboardURL = null;
System.exit(1);
}
FormatConverter converter = new ObjToJme();
converter.setProperty("mtllib", whiteboardURL);
ByteArrayOutputStream BO = new ByteArrayOutputStream();
try
{
converter.convert(whiteboardURL.openStream(), BO);
Node whiteboard = (Node) BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
whiteboard.setLocalScale(.01f);
whiteboard.setLocalTranslation(new Vector3f(0, 0, -50));
rootNode.attachChild(whiteboard);
}
catch(IOException e)
{
System.out.println("Failed to convert whiteboard Wavefront .obj model to .jme model.");
e.printStackTrace();
System.exit(0);
}
I've already searched for topics like this, but they haven't really helped...