hi,
 
That what i was thinking of. Which means that if i use By-reference i cannot use the appearance of the shap3D class. It is what i think but in fact i am not so sure. and i wanted to know if it is possible to use Appearance and By-reference ?????
 
anyway what you said works i try already.
 
thanks
-----Message d'origine-----
De : Dani F. <[EMAIL PROTECTED]>
Ŕ : [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date : mardi 10 juin 2003 12:00
Objet : Re: [JAVA3D] Appearance Problem

Hi:
 
I'm not really sure... but I think your problem is that the ColorCube has 6 shapes... so if you want to change the appearance, you'll have to do something like:
int numshapes= colorcube.numShapes(); //or numChildren();
for (int i=0;i<numshapes;i++) {
    // Change the appearance of each shape
}
 
I hope this is your problem.
 
Cheers,
   Dani.
----- Original Message -----
From: hterrolle
Sent: Tuesday, June 10, 2003 11:08 AM
Subject: [JAVA3D] Appearance Problem

Hi,
 
I got a new little problem with the Appearance.
 
 
Class ColorCube {
 
   QuadArray cube = new QuadArray(400, QuadArray.COORDINATES |
           QuadArray.NORMALS | QuadArray.BY_REFERENCE );
 
  /**** of course i got the vertex by ref
}
 
class build {
     shape = new ColorCube(0.1);
     Geometry test = shape.getGeometry();
     shape.setAppearanceOverrideEnable(true);
 
     test.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);
     test.setCapability(GeometryArray.BY_REFERENCE);
 
     shape.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
     shape.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
     shape.setCapability(Shape3D.ENABLE_PICK_REPORTING);
     shape.setCapability(Shape3D.ENABLE_PICK_REPORTING);
     shape.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
     shape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
     shape.setCapability(Shape3D.ALLOW_LOCAL_TO_VWORLD_READ );
     PickTool.setCapabilities(shape, PickTool.INTERSECT_FULL);
 
     PolygonAttributes attr = new PolygonAttributes();
     attr.setPolygonMode(PolygonAttributes.POLYGON_LINE);
     attr.setCullFace(PolygonAttributes.CULL_NONE);
 
     Appearance ap = new Appearance();
     ap.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);
     ap.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
     ap.setPolygonAttributes(attr);
     shape.setAppearance(ap);
}
 
 
When i try to change the appearance nothing new appear
 
   shape  = (Shape3D)tablesel.getChild(0);
   PolygonAttributes attr = new PolygonAttributes();
   attr.setPolygonMode(PolygonAttributes.POLYGON_FILL);
   attr.setCullFace(PolygonAttributes.CULL_NONE);
 
   ap = new Appearance();
 
   if (colorchoise != null){
       newcolor = new Color3f((Color)colorchoise);
       ap.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);
       ap.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
       ColoringAttributes highlight3 = new ColoringAttributes(newcolor,
       ColoringAttributes.SHADE_GOURAUD);
       ap.setColoringAttributes(highlight3);
       Material mat = new Material(newcolor, newcolor, newcolor, newcolor, 10.0f);
       mat.setLightingEnable(true);
       ap.setMaterial(mat);
       System.out.println("Pickselection couleur : "+ colorchoise);
 
     }
 
   ap.setPolygonAttributes(attr);
   shape.setAppearance(ap);
I spend 4 days and i really do not know butit works with the Java Sphere class
 
 
Thanks
 
        Herve

Reply via email to