Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Shape 3D setAppearance problem in Java3D  RSS feed

 
David Llewellyn
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured it out,
basically I needed to generate normals using the geometryInfo class.

cheers.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!