I am new to J3D and cant get a basic Box drawn.
Right now I am just play with sample code and replacing the ColorCube constructor with the Box constructor wih no success.
It compiles and shows a black canvas, I made sure to add import com.sun.j3d.utils.geometry.Box;
Please set me right. What is wrong?
Here the code I am focusing on:
//Commented out-- //objRoot.addChild(new ColorCube(0.4));
//My Box code
objRoot.addChild(new Box());
public class HelloJava3Da extends Applet {
public HelloJava3Da() {
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 HelloJava3Da (constructor)
public BranchGroup createSceneGraph() {
// Create the root of the branch graph
BranchGroup objRoot = new BranchGroup();
//Commented out-- //objRoot.addChild(new ColorCube(0.4));
//My Box code
objRoot.addChild(new Box());
return objRoot;
} // end of CreateSceneGraph method of HelloJava3Da