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());1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| 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 simpleU = new SimpleUniverse(canvas3D);
simpleU.getViewingPlatform().setNominalViewingTransform();
simpleU.addBranchGraph(scene); } public BranchGroup createSceneGraph() { BranchGroup objRoot = new BranchGroup();
objRoot.addChild(new Box());
return objRoot; } |