hi,
i want to add branchgroups in the rendered scene when an active ViewPlatform intersects the specified boundary,at the same time,i maybe remove some branchgroups that it is no use,but i don’t know if it is useful because java seems doesn’t release any memory.so if i want to realease some memory when i remove some branchgroups ,is there any new methord? could anybody tell me? thx.
If the BG are no longer in the scenegraph and not referenced else where, Java will remove them as soon as it runs out of memory with the GC.
Unfortunately, there still seem to be some memory leaks here and there (e.g. references kept by Java3D internally), so this might bring you into trouble, when doing that too often.
Rendering-wise, Java3D will not render subgraphs that are not visible (by means of their bounds) so it’s ok to leave the graph established.
by the way,it’s better to use detach BG than remove BG?is it true?why?
Hi
There are performance issues to consider too, removing an bg from the scene graph seems to take aaaages (when compared to a single frame render), if you are going to be adding objects with the same geometry later as contained in that branchgroup, it’s probably better to locate it and scale it so it can’t be seen, then grab it and modify it later when you want to add things back. This isn’t nice, but will save you the performance hit, and possibly save you from some memory leaks, on the other hand, if the objects are hanging around you can’t free them up to make memory for something else, it depends on your app, but thats the way things look as of now.
HTH
Endolf