| Author |
Shape 3D setAppearance problem in Java3D
|
David Llewellyn
Ranch Hand
Joined: Feb 01, 2005
Posts: 45
|
|
Hi, Ive created a custom shape which I generate in a method called makeBezier() which returns a geometry array. This method below seems to be giving me problems, because Im passing it red colours, but i still see my object as white with no lighting on the screen. Am I doing anything wrong in the code below? cheers! public void addBezier(Color3f diffuse, Color3f spec) { //appearance Appearance app = new Appearance(); Material mat = new Material(); mat.setDiffuseColor(diffuse); mat.setSpecularColor(spec); mat.setShininess(5.0f); app.setMaterial(mat); //disable backface culling PolygonAttributes pa = new PolygonAttributes(); pa.setCullFace(PolygonAttributes.CULL_NONE); app.setPolygonAttributes(pa); //geometry Geometry bezierShape; bezierShape = makeBezier();//returns shape Shape3D bezShape = new Shape3D(bezierShape); bezShape.setAppearance(app); bezBranch.addChild(bezShape); //create a transform group and make it the parent of the box TransformGroup tg = new TransformGroup(); tg.addChild(bezBranch); //etc etc....
|
 |
David Llewellyn
Ranch Hand
Joined: Feb 01, 2005
Posts: 45
|
|
I figured it out, basically I needed to generate normals using the geometryInfo class. cheers.
|
 |
 |
|
|
subject: Shape 3D setAppearance problem in Java3D
|
|
|