Hey guys, I'm trying to load a model wth jME (it's an .OBJ). I followed the Starter's Guide on model loading, but when I run the program, I get the jME start screen, click Ok, get a black screen, and about .5 seconds later the app closes.
I have the model in the same directory as the .java file, and the .MTL file also.
This is my code (after the imports):
public class BloomTest extends SimpleGame {
public static void main(String[] args) {
BloomTest app = new BloomTest();
app.setDialogBehaviour(AbstractGame.ALWAYS_SHOW_PROPS_DIALOG);
// Turn the logger off so we can see the XML later on
app.start();
}
protected void simpleInitGame() {
// Point to a URL of my model
URL model= BloomTest.class.getClassLoader().getResource("bloomtest.obj");
// Create something to convert .obj format to .jme
FormatConverter converter=new ObjToJme();
// Point the converter to where it will find the .mtl file from
converter.setProperty("mtllib",model);
// This byte array will hold my .jme file
ByteArrayOutputStream BO=new ByteArrayOutputStream();
try {
// Use the format converter to convert .obj to .jme
converter.convert(model.openStream(), BO);
Node sphere=(Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
// Put her on the scene graph
rootNode.attachChild(sphere);
} catch (IOException e) { // Just in case anything happens
System.out.println("Damn exceptions!" + e);
e.printStackTrace();
System.exit(0);
}
}
}
Any ideas what I did?
Thanks in advance!
(BTW, I just copied the code from the Starter Guide, and took out a few lines that were giving me trouble, so if the comments look funny...)