aspose file tools
The moose likes Other JSE/JEE APIs and the fly likes Shape 3D setAppearance problem in Java3D Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Reply Bookmark "Shape 3D setAppearance problem in Java3D" Watch "Shape 3D setAppearance problem in Java3D" New topic
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Shape 3D setAppearance problem in Java3D
 
Similar Threads
Help needed to run a Java3D program!
Java 3D: Need to get the Box vertex
Error (compile time) for JAVAX package
Java 3d: Cylinder with GEOMETRY_NOT_SHARED showing up white
Scaling the Image.