> Can someone give me some code that will show me how to make a QuadArray? I
> want to see a working example if you can and can someone tell me how to
use
> a QuadArray properly?
This function wille create a BranchGroup with a QuadArray in it. It is a
plane on y=-1, hope that helps:
public BranchGroup createGeometry()
{
BranchGroup bg=new BranchGroup();
Shape3D shape=new Shape3D();
QuadArray plane=new QuadArray
(4,GeometryArray.COORDINATES|GeometryArray.NORMALS);
// Set coordinates of the four points that define this QuadArray
plane.setCoordinate(0, new Point3f(-1.0f, -1.0f, -1.0f));
plane.setCoordinate(1, new Point3f(1.0f, -1.0f, -1.0f));
plane.setCoordinate(2, new Point3f(1.0f, -1.0f, 1.0f));
plane.setCoordinate(3, new Point3f(-1.0f, -1.0f, 1.0f));
Vector3f normal=new Vector3f(0.0f, 1.0f, 0.0f);
plane.setNormal(0, normal);
plane.setNormal(1, normal);
plane.setNormal(2, normal);
plane.setNormal(3, normal);
shape.setGeometry(plane);
// Create an Appearance for the QuadArray
Appearance appearance=new Appearance();
Material material=new Material();
material.setDiffuseColor(new Color3f(1.0f, 0.0f, 0.0f));
material.setAmbientColor(new Color3f(0.2f, 0.2f, 0.2f));
appearance.setMaterial(material);
PolygonAttributes polyAttrib=new PolygonAttributes();
// Leaving the next line out will create a filled polygon
polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_LINE);
polyAttrib.setCullFace(PolygonAttributes.CULL_NONE);
polyAttrib.setBackFaceNormalFlip(true);
appearance.setPolygonAttributes(polyAttrib);
shape.setAppearance(appearance);
// Add Shape3D to BranchGroup and return it
bg.addChild(shape);
return bg;
}
===========================================================================
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".