i’m trying to use OBJLoader2 but I’m getting just a blank window even though the model seems to have loaded fine and if i substitute a xith primitive geometry it works fine and i can see it… so i’m wondering what i’m doing wrong…
VirtualUniverse universe = new VirtualUniverse();
universe.addView(view);
Locale locale = new Locale();
universe.addLocale(locale);
File modelFile = new File(MODEL_OBJ_FILENAME);
Scene model = null;
try {
model = (new OBJLoader2().load(modelFile.getAbsolutePath()));
System.out.println("scene model successfully loaded");
} catch (Exception e) {
System.out.println("Nope");
}
BranchGroup modelBG = model.getSceneGroup();
locale.addBranchGraph(modelBG);
modelBG.compile();
// create a canvas for our graphics
RenderPeer rp = new RenderPeerImpl();
CanvasPeer cp = rp.makeCanvas(null, 640, 480, 32, false);
Canvas3D canvas = new Canvas3D();
canvas.set3DPeer(cp);
// modify our view so we can see the cube
view.addCanvas3D(canvas);
view.getTransform().lookAt(
new Vector3f(0, 0, 2f), // location of eye
new Vector3f( 0, 0, 0), // center of view
new Vector3f( 0, 1, 0)); // vector pointing up
view.startView();