I want to change the color in coloringattributes of shape, which is part
of a life scenegraph...

I set the capabilities of appearance, coloringattributes and shape
accordingly:

shape.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
shape.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);

colattr.setCapability(ColoringAttributes.ALLOW_COLOR_READ);
colattr.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE);

and...

app.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ);
app.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);

   Appearance app = shape.getAppearance();
   ColoringAttributes colattr = app.getColoringAttributes();
   Color3f color = new Color3f();
   colattr.getColor(color);
   JColorChooser cc = new JColorChooser();
   Color newcol = cc.showDialog(this, "Choose Color", new Color(color.x,
color.y, color.z));
   float r = newcol.getRed()/256f;
   float g = newcol.getGreen()/256f;
   float b = newcol.getBlue()/256f;
   colattr.setColor(new Color3f(r, g, b));
   app.setColoringAttributes(colattr);
   shape.setAppearance(app);

but the code does not yield the desired result...

can someone give me a hint? (I already compared the references of the
shape-instance... it is the same at any
time during execution of the app)

so I have to call a kind of refresh-routine for the scenegraph after
modifying the color?

michy

=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to