Re: Recreating scene graph with VisAD


Hi,

Thanks for the reply.  I am modifying the DisplayRendererJ3D class to
enable us to modify the "camera" or viewer's position instead of rotating
the object in 3D space.  Basically, we have a method that at one time
called a ProjectionControl object to set the matrix for our object's 3D
transformations via the setMatrix( ... ) function in ProjectionControl.  So
I decided instead of modifying the object's rotations, it is much more
intuitive to move the camera around the object.  Therefore, I modified the
DisplayRenderJ3D to allow me to change the view nodes in the scene graph
(particularly those like the view and the vpTrans) in order to move the
camera about the scene.  This is all fine and works beautifully.  

However, there were the problems of opening multiple files as I alluded to
in my previous email, of which I will explain further.  Essentially, we are
writing an application in which you can have multiple files open at a time.
 Each file is a 3D canvas in which data is rendered in 3D. When you open a
file, and then close it, the destroy( ) function in DisplayRendererJ3D is
called and basically wipes out only portions of the scene graph, notably
the canvas, mouse listener, the root (the root branch group of the locale),
the vpTrans (transform group for the view platform) and the view object
itself.  Therefore, these objects are all set to null when the file is
closed.  Then, when we try to open a new file, VisAd throws a null pointer
exception, because setting up the camera requires me to have a valid handle
to the view and the vpTransform ( which were deleted when portions of the
last scene graph was destroyed ). Therefore, my question is, how do I keep
the scene graph from being destroyed from one file to the next, or how do I
get the view portions of the scene graph re-created before any geometry is
to be rendered?

Thanks in advance for your time.

Greg


Bill Hibbard writes:

> On Wed, 17 Jul 2002, Greg Buron wrote:
> 
> > I have a question regarding recreating the scene graph with VisAd.  I am
> > working on an application in which an object is created and a scene graph
> > is created (somehow) and then when that file is closed, the scene graph is
> > destroyed.  Then, when I try to open a new file in the same application I
> > run into a null pointer exception because in the DisplayRendererJ3D class,
> > when the renderer tries to access the view and vpTrans transform group.
> 
> We never see this behavior. You need to tell us what
> VisAD methods you are calling to cause the Exception,
> and whether you are directly manipulating the Java3D
> scene graph by extending VisAD classes or some other
> means.
> 
> Bill
>