Hi Matthew,

> I would like an application to be able to dynamically compile and render
> objects from data sets chosen through a UI. At what level can I clear and
> recompile a scene to display a new set of objects?

I just answered a similar question on comp.lang.java.3d, so I
simply copy/paste part of that here.

----- snip -----

For the J3D part, namely the exchange of the scenegraph everytime
the users presses Execute, one way to go would be to build up
your Universe only once (at init() time) with only a root
Branchgroup attached to the Locale. This root BG must have
the Capability ALLOW_CHILDREN_EXTEND set:

  bgRoot.setCapability(Group.ALLOW_CHILDREN_EXTEND);

Your createSceneGraph() method then must return another
BranchGroup (which it does already) with the Capability
ALLOW_DETACH set (which it doesn't yet):

  public BranchGroup createSceneGraph() {
    BranchGroup bgTop = new BranchGroup();
    ...
    bgTop.setCapability(BranchGroup.ALLOW_DETACH);
    return bgTop;
  }

Your code in the Execute Button's actionPerformed() then would
detach any already existing bgTop from the bgRoot, call
createSceneGraph() and add the new bgTop to the bgRoot.

+ Locale
  |
  + bgRoot           Group.ALLOW_CHILDREN_EXTEND set
    |
    + bgTop          BranchGroup.ALLOW_DETACH set
      |
      + dynamicBox0
      |
      + dynamicBox1
      .
      .

----- snap -----

regards

Georg
 ___   ___
| + | |__    Georg Rehfeld      Woltmanstr. 12     20097 Hamburg
|_|_\ |___   [EMAIL PROTECTED]           +49 (40) 23 53 27 10

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to