The problem here is that you are trying to change the Geometry of a
Primitive.  Primitives by default have a shared geometry and thus shared
appearance. Here is the blurb from the Javadoc, it suggests changing the
shared geometry flag to get around this.

"Base class for all Java 3D primitives. By default all primitives with
the same parameters share their geometry (e.g., you can have 50 shperes
in your scene, but the geometry is stored only once). A change to one
primitive will effect all shared nodes. Another implication of this
implementation is that the capabilities of the geometry are shared, and
once one of the shared nodes is live, the capabilities cannot be set.
Use the GEOMETRY_NOT_SHARED flag if you do not wish to share geometry
among primitives with the same parameters."

Cheers

Dave
    -----Original Message-----
    From: Michael Schnieders [mailto:[EMAIL PROTECTED] 
    Sent: 13 August 2003 06:50
    To: [EMAIL PROTECTED]
    Subject: [JAVA3D] Changing the Appearance of a Live Shape3d
    
    
    oops.
    
    I create a specific Appearance node for each of my Shape3D 
    nodes and save references to each. Many of the appearences 
    are identical initially, although they may each eventually 
    have unique colors as a result of user input.
    
    While the scene is live, I call the Appearance node 
    "setMaterial" method to change the color of Shape3D objects.
    
    It seems as though Java3D might have tried to "merge" 
    Appearance nodes together, because a small percentage of 
    changes are mapped to Shape3D objects that reference some 
    other Appearance object.
    
    For example does this code appear correct (assuming I 
    create lots of "foo"
    instances) :
    
    class foo {
    
    Appearance ap;
    
    foo(){
    ap = new Appearance; 
    ap.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
    Shape3D shape = new Shape3D();
    shape.setAppearance(ap);
    //... the shape gets added to a the Scenegraph, etc.
    }
    
    
    // This gets called to change the Shape's color in response 
    to user input
    
    void changeMaterial(Material mat){
    ap.setMaterial(mat);
    }
    
    _________________________________________________________________
    Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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

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