Hi Daniel,

>MIME-Version: 1.0
>Date: Fri, 17 Nov 2000 12:41:00 -0500
>From: "Dvorak, Daniel J." <[EMAIL PROTECTED]>
>Subject: Re: [JAVA3D] Removing Object from Scene Graph
>To: [EMAIL PROTECTED]
>
>Doesn't the  VirtualUniverse.removeAllLocales() remove the view side of the
>SU as well?  Then I've got to go about rebuilding it line by line?  Is there
>a way just to remove all the content side of the scene graph with just one
>line?  right now I'm using the following:
>
>
>        Enumeration allBGs = dummyU.getLocale().getAllBranchGraphs();
>
>        // first branchgroup is the view branch, leave it alone...
>        BranchGroup BG = (BranchGroup)allBGs.nextElement();
>
>        // if another branchgroup exists, it is the content group, so remove
>it.
>        if (allBGs.hasMoreElements()) {
>            BG = (BranchGroup)allBGs.nextElement();
>            dummyU.getLocale().removeBranchGraph(BG);
>            BG=null;
>        }
>
>

Yes, it will remove the view branch as well.
The following is used if the program only want to replace
the View from the scene graph only

    simpleuniverse.getViewer().setViewingPlatform(null);
    simpleuniverse.getViewer().getView().removeCanvas3D(c3d);

In fact, the above two statements is another way to cleanup
the Java3D internal threads instead of
VirtualUniverse.removeAllLocales()

Currently there is no API to remove just the content side
of scene graph without removing the View branch.

Instead of just remove the content branch, it is recommend to
call removeAllLocales() in the original VirtualUniverse,
then new a VirtualUniverse and attach the old View branch
group to this newly create VirtualUniverse. Once the view branch
group is attach, Java3D will recreate the internal threads
for the scene graph. This can be used to workaround
memory leak bug right now. If, however, the View branch is
not reuse and removeAllLocales() is not invoked, then

  simpleuniverse.getViewer().setViewingPlatform(null);
  simpleuniverse.getViewer().getView().removeCanvas3D(c3d);

in the View branch must call to free memory.

Thanks.

- Kelvin
------------------
Java 3D Team
Sun Microsystems Inc.



------------- End Forwarded Message -------------

===========================================================================
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