Here is some sample code for setting the appearance for a Shape3D object (a
red colored XY-Plane):

Shape3D shape = new Shape3D();

TriangleStripArray geometry = new TriangleStripArray(4,
TriangleStripArray.COORDINATES, new int[] {4});
Point3d[] points = new Point3d[] {
        new Point3d(1e6, 1e6, 0), new Point3d(-1e6, 1e6, 0),
        new Point3d(-1e6, -1e6, 0), new Point3d(1e6, -1e6, 0)
};
geometry.setCoordinates(0, points);
shape.setGeometry(geometry);

Appearance appearance = new Appearance();
ColoringAttributes ca = new ColoringAttributes();
ca.setColor(new Color3f(1, 0, 0));
appearance.setColoringAttributes(ca);

Material material = new Material(new Color3f(0.2f, 0.2f, 0.2f), new
Color3f(0.1f, 0, 0), new Color3f(1, 0.8f, 0.8f), new Color3f(Color.WHITE),
64);
appearance.setMaterial(material);

shape.setAppearance(appearance);


I guess that your lighting is not enabled as well, since the shape should be
shaded when lighting is enabled. Check the setInfluencingBounds for your
lights to include your Shape3D.

> -----Ursprüngliche Nachricht-----
> Von: Robert Gomez-Reino [mailto:[EMAIL PROTECTED]
> Gesendet: Montag, 22. September 2003 18:14
> An: [EMAIL PROTECTED]
> Betreff: Re: [JAVA3D] AW: [JAVA3D] creating shapes from GeometryArray
> 
> 
> Yes, I have an ambient light and two directional lights, but 
> I can't set the
> Appearance of my shapes, they are all white(the default white).
> Boby
> 
> ----- Original Message -----
> From: "Dietrich, Harald" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, September 22, 2003 6:00 PM
> Subject: [JAVA3D] AW: [JAVA3D] creating shapes from GeometryArray
> 
> 
> Obviously something is wrong with your Shape3D appearance. 
> White is the
> default setting for the appearance of an scene graph object. 
> So it looks
> like you do not set a proper appearance.
> Setting the appearance for the Shape3D is enough. You do not 
> have to set
> color or texture explicitly for your geometry array as long 
> as the geometry
> array shall not have more than one textures or colors.
> Are you using lightning in your scene graph?
> 
> Harald
> 
> -----Ursprüngliche Nachricht-----
> Von: Robert Gomez-Reino [mailto:[EMAIL PROTECTED]
> Gesendet: Montag, 22. September 2003 17:52
> An: [EMAIL PROTECTED]
> Betreff: Re: [JAVA3D] creating shapes from GeometryArray
> 
> 
> An extension of my question......
> Is the only way to solve this to use the methods of GeometryArray
> (setColors(), setTextures().....) ?
> Boby
> ----- Original Message -----
> From: Robert Gomez-Reino
> To: [EMAIL PROTECTED]
> Sent: Monday, September 22, 2003 5:49 PM
> Subject: [JAVA3D] creating shapes from GeometryArray
> 
> 
> Hi all,
> I am creating shapes3D using the class GeometryArray and the method
> addGeometry() de Shape3D. The thing is that I though that I 
> was going to be
> able to use the method setAppearance() to set the 
> ....appearance of this
> shapes3D. If I do it the shapes remain in white color. Can 
> anybody help me
> with this.
> Thanks.
> Boby
> ==============================================================
> =============
> 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".
> 
> ==============================================================
> =============
> 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".
> 

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