Without knowing the exact code you use to get the appearance attributes, i
would suggest that you try setting Material.ALLOW_COMPONENT_READ and
Material.ALLOW_COMPONENT_WRITE .

-B.D.


>From: Kynn Jones <[EMAIL PROTECTED]>
>Reply-To: Discussion list for Java 3D API <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: [JAVA3D] Changing the color of a Shape3D
>Date: Tue, 26 Jun 2001 18:23:40 -0400
>
>Surely it cannot be so insanely difficult to do something this simple.
>I am trying to write code to change the color of a Shape3D object.
>The Shape3D object is created using this method:
>
>   private Box makeBox(Color3f color) {
>     Appearance app = new Appearance();
>     app.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ);
>     app.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);
>
>     // adding the next two lines makes no difference
>     // app.setCapability(Appearance.ALLOW_MATERIAL_READ);
>     // app.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
>
>     Box box = new Box(0.2f, 0.2f, 0.2f, app);
>
>     ColoringAttributes ca = new ColoringAttributes(color,
>ColoringAttributes.FASTEST);
>     app.setColoringAttributes(ca);
>
>     box.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
>     box.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
>
>     // adding the next line makes no difference
>     // box.setCapability(Primitive.ENABLE_APPEARANCE_MODIFY);
>
>     return box;
>   }
>
>Still, I get the runtime error:
>
>   javax.media.j3d.CapabilityNotSetException: Shape3D: no capability to get
>appearance
>            at javax.media.j3d.Shape3D.getAppearance(Shape3D.java:430)
>            at
>com.sun.j3d.utils.geometry.Primitive.getAppearance(Primitive.java:166)
>            at
>MyPickCallbackApp$MyCallbackClass.transformChanged(MyPickCallbackApp.java:33)
>
>   ...
>
>(Notice that the error happens even when the code attempts to get--not
>change--the appearance.)
>
>This seems to contradict the following (from the Archives):
>
>    Date:         Tue, 14 Sep 1999 06:58:24 -0700
>    From:         Kevin Rushforth <[EMAIL PROTECTED]>
>    Subject:      Re: Changing Sphere Color
>
>    Since you can create your own appearance and use that appearance to
>    construct a [Shape3D], you have full control over the capability bits
>    that are set in the appearance.
>
>I've jumped through every hoop I can think of to get this to work.
>
>Any suggestions?
>
>Thanks!
>
>KJ
>
>===========================================================================
>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".

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

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