Hi,
Once you start defining your own materials for objects you have to include
light sources before you see anything. Try adding the following method to
your code and just add the returned BranchGroup to the root of your scene
graph. Obviously this is just to get you started and you can add/customize
light sources to meet your needs.
Hope this helps,
Ewan
public BranchGroup createLights()
{
// Create bounds in which lights are viewed
BoundingSphere infiniteBounds = new BoundingSphere(new Point3d(),
Double.POSITIVE_INFINITY);
BranchGroup light = new BranchGroup();
// Create ambient light
AmbientLight ambientLight = new AmbientLight(true, new Color3f(0.2f, 0.2f,
0.2f));
ambientLight.setInfluencingBounds(infiniteBounds);
light.addChild(ambientLight);
// Create a directional light to show up surface shading
DirectionalLight directionalLight = new DirectionalLight(true, new
Color3f(0.8f, 0.8f, 0.8f), new Vector3f(-1, 0, -1));
directionalLight.setInfluencingBounds(infiniteBounds);
light.addChild(directionalLight);
return light;
} // createLights
----- Original Message -----
From: "Vijayaraghavan Rajagopal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 06, 2002 4:26 AM
Subject: [JAVA3D] Shapes in Java 3D
> Hi,
> I am beginner to Java and Java 3D programming. I did a tutorial to draw a
cube. Then I added the package for a cone and tried to show a cone, but I
get a blank screen. Here is the code.
>
> public BranchGroup createSceneGraph()
> {
> BranchGroup objroot = new BranchGroup();
> /*Transform3D rotationx = new Transform3D();
> Transform3D rotationy =new Transform3D();*/
> Appearance appearance = new Appearance();
> Material material = new Material(red, black,red,white,64);
> appearance.setMaterial(material);
>
>
> Cone cone = new Cone(1.0f, 2.0f, appearance);
> objroot.addChild(cone);
> return objroot;
> }
> This method is in a class that starts up a GUI extending the Frame class.
> I set up constants for the colors red black grey and stuff.
> Can anyone help me?
>
>
> __________________________________________________________________
> Your favorite stores, helpful shopping tools and great gift ideas.
Experience the convenience of buying online with Shop@Netscape!
http://shopnow.netscape.com/
>
> Get your own FREE, personal Netscape Mail account today at
http://webmail.netscape.com/
>
>
===========================================================================
> 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".