It has been a while since I figured out exactly why this is so with
the Sun utility shapes but I think it goes something like this...

Although the ability to access the appearance is set the ability to
access the appearance material is not.  And, you can't set the ability
to access the material because the shapes are internally compiled.  I
also recall that the fact that appearance is set by reference and not
by value (a copy) also complicates matters.  Welcome to Java 3D.

Bottom line is you have to effectively use/create a new material and a
new appearance each time you want to change the color.

--jon

> Date:    Mon, 13 Sep 1999 08:48:04 -0400
> From:    Bob Gray <[EMAIL PROTECTED]>
> Subject: Changing Sphere Color
>
> Why is nothing simple???
>
> I define MySphere as an extension of Sphere.
> I add it to my scene graph.
>
>      MySphere theSphere = new MySphere();
>      theSphere.setAppearance(createAppearanceProton());
>      theSphere.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
>      theSphere.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
>      objPSize.addChild(theSphere);
>
> Note the ALLOW_APPEARANCE_READ capability....
>
> After the scene is compiled and active, I want to change the sphere's
> color.  So I get the appearance of the sphere by
>
>      Appearance PA = theApp.theSphere.getAppearance();
>      Material theMaterial = PA.getMaterial();
>      theMaterial.setDiffuseColor(red, green, blue);
>
> But this fails with a
> "Shape3D: no capability to get appearance"
> exception.
>
> So how do you set the capability to read (and write) the
> appearance of a Sphere object?  Or is there some other
> problem which is preventing me from doing this?
>
> Bob Gray

--
____________________ Peculiar Technologies ____________________
Jon Barrilleaux       3800 Lake Shore Ave.         Purveyors of
[EMAIL PROTECTED]        Oakland, CA 94610      Alternate Reality
510.444.4370 voc                           Augmented Simulation
510.444.0231 fax        www.augsim.com         and 3D Solutions

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