Re: Can not add child to root scenegraph of DisplayRendererJ3D

  • To: Jianting Zhang <jianting@xxxxxx>
  • Subject: Re: Can not add child to root scenegraph of DisplayRendererJ3D
  • From: Bill Hibbard <billh@xxxxxxxxxxxxx>
  • Date: Wed, 21 May 2003 03:09:34 -0500 (CDT)
Hi Jianting,

> I'm trying to add another  light source . However, for the following
> code, I got error message
> "javax.media.j3d.RestrictedAccessException: Cannot modify capability
> bits on a live or compiled object" for during executing
> "root.setCapability(Group.ALLOW_CHILDREN_EXTEND)"
> It seems that  the root scenegraph of DisplayRendererJ3D is live. Any
> suggestion to solve this problem.
>
> Thanks.
>
> Jianting
>
> DisplayRendererJ3D dr =(DisplayRendererJ3D)
> display.getDisplayRenderer();
> BranchGroup root = dr.getRoot();
> System.out.println("is compiled?"+root.isCompiled());
> System.out.println("is live?"+root.isLive());
> root.setCapability(Group.ALLOW_CHILDREN_EXTEND);

You shouldn't need to do this. It is already done when root
is constructed, at line 492 of DisplayRendererJ3D.java.

> BoundingSphere bounds =new BoundingSphere(new Point3d(0.0,0.0,0.0),
> 100.0);
> Color3f alColor = new Color3f(0.2f, 0.2f, 0.2f);
> AmbientLight aLgt = new AmbientLight(alColor);
> aLgt.setInfluencingBounds(bounds);
> root.addChild(aLgt);

I think you cannot add anything but a BranchGroup to a
live scene graph. Try constructing a new BranchGroup(),
adding aLgt to it, then adding the BranchGroup to root.

Good luck,
Bill


  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: