Dear Java 3D Experts,

I am having difficulties adding new nodes to a live scene graph. I am running
Java 3D API 1.1.1, OpenGL version, with JDK 1.2 on a Windows 98 system. 

If I built the content branch with a Shape3D (ColorCube for testing purposes) in
its path and attached the branch to the universe which I have created using the
SimpleUniverse class, I can see that the cube was rendered and displayed just
fine. However, if I simply created the content branch node by itself, attached
it to the simple universe, and then built and attached a new branchgroup node
(with the ColorCube node attached to it) to the content branch node, I can only
see a blank, black screen.

Here is the listing of the relevant code:

// Create an empty scene graph. 
// Note that myGUI is an object of a class that extends Frame. A Canvas3D object
is created and added
// to myGUI object. 
SimpleUniverse universe = new SimpleUniverse(myGUI.getCavas3D());
universe.getViewingPlatform().setNominalViewingTransform();
BranchGroup contentRoot = new BranchGroup();
contentRoot.setCapability(Group.ALLOW_CHILDREN_EXTEND);
contentRoot.setCapability(Group.ALLOW_CHILDREN_WRITE);
contentRoot.setCapability(Group.ALLOW_CHILDREN_READ); 
universe.addBranchGraph(contentRoot);

// Add a cube via a menu selection from myGUI object
Transform3D transform = new Transform3D();
transform.setScale(0.4);
TransformGroup cubeGroup = new TransformGroup(transform);
cubeGroup.addChild(new ColorCube());
BranchGroup cubeBranch = new BranchGroup();
cubeBranch.addChild(cubeGroup);
contentRoot.addChild(cubeBranch);


I would greatly appreciate it if someone can point out what I am missing here to
have the cube rendered in this setting. I have read the Java 3D specification
and the Java 3D newsgroup and it seems that I should be able to add new nodes
into a live scene graph. Unfortunately, I have not been successful. 

Thank you so much for your assistance,

Veasna Heng

Email: [EMAIL PROTECTED]
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to