in your code :
 appearance.setColoringAttributes (new ColoringAttributes (new Color3f(2.0f,
1.0f, 3.5f),1));

in the documentation, about Color3f :
A three-element color value represented by single precision floating point
x,y,z values. The x,y,z values represent the red, green, and blue color
values, respectively. Color components should be in the range of [0.0, 1.0].

So it might be the incorrect values (2.0f, 1.0f, 3.5f) you gave to your
Color3f (valid value range is [0.0, 1.0]), which are causing your problem.

PS: you should use  FASTEST, NICEST, SHADE_FLAT, or SHADE_GOURAUD for the
shademodel, instead of using an int :  ColoringAttributes (new Color3f(2.0f,
1.0f, 3.5f),  1  )
for example : new ColoringAttributes (new Color3f(2.0f, 1.0f,
3.5f),ColoringAttributes.NICEST)

----- Original Message -----
From: Saeed Ansari
To: JAVA3D-INTEREST@JAVA.SUN.COM
Sent: Thursday, May 19, 2005 1:55 PM
Subject: [JAVA3D] Problem with Material


Hi,
I have used material, but it doesn't work and all of shapes are dark.
Below is my code :

    Appearance appearance=new Appearance();
    appearance.setColoringAttributes (new ColoringAttributes (new
Color3f(2.0f, 1.0f, 3.5f),1));
    appearance.setPolygonAttributes(polyAtt);
    Material mat=new Material();
    mat.setAmbientColor(new Color3f(0.0f,0.0f,1.0f));
    mat.setDiffuseColor(new Color3f(0.7f,0.7f,0.7f));
    mat.setSpecularColor(new Color3f(0.7f,0.7f,0.7f));
    appearance.setMaterial(mat);
    shape.setAppearance(appearance);

Is something forgotten to add ?

Regards,
Saeed





Saeed Ansari [EMAIL PROTECTED]
Islamic Azad University of  Qazvin , Faculty of computer & IT.
Header  Of  MRL Soccer Simulation Team.



Yahoo! Mail Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
===========================================================================
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