Hi,
I drew the box in 3d max and I want to display it using java 3d
my question are in what format can I export the box and how can I use loader
I tried before and this my tries:
I export the file in .OBJ format
code:
[quote]import com.sun.j3d.loaders.objectfile.ObjectFile;
import com.sun.j3d.loaders.ParsingErrorException;
import com.sun.j3d.loaders.IncorrectFormatException;
import com.sun.j3d.loaders.Scene;
import java.applet.Applet;
import javax.media.j3d.;
import javax.vecmath.;
import java.io.*;
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.event.;
import java.awt.GraphicsConfiguration;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.geometry.ColorCube;
import com.sun.j3d.utils.universe.;
import javax.media.j3d.;
import javax.vecmath.;
public class ObjLoad extends Applet {
private String filename = “test”;
public BranchGroup createSceneGraph() {
// Create the root of the branch graph
BranchGroup objRoot = new BranchGroup();
ObjectFile f = new ObjectFile();
Scene s = null;
try {
s = f.load(filename);
}
catch (FileNotFoundException e) {
System.err.println(e);
System.exit(1);
}
catch (ParsingErrorException e) {
System.err.println(e);
System.exit(1);
}
catch (IncorrectFormatException e) {
System.err.println(e);
System.exit(1);
}
objRoot.addChild(s.getSceneGroup());
return objRoot;
}
public ObjLoad() {
setLayout(new BorderLayout());
GraphicsConfiguration config =
SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas3D = new Canvas3D(config);
add("Center", canvas3D);
BranchGroup scene = createSceneGraph();
// SimpleUniverse is a Convenience Utility class
SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
// This will move the ViewPlatform back a bit so the
// objects in the scene can be viewed.
simpleU.getViewingPlatform().setNominalViewingTransform();
simpleU.addBranchGraph(scene);
} // end of HelloJava3Db (constructor)
// The following allows this to be run as an application
// as well as an applet
public static void main(String[] args) {
Frame frame = new MainFrame(new ObjLoad(), 256, 256);
} // end of main (method of HelloJava3Db)
} // end of class HelloJava3D
[/quote]
and I have this error in the run time:
java.io.FileNotFoundException: test (The system cannot find the file specified)
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.