Hi,
I'm sure there is an easy answer to this, but I still can't get it to work.
What I'm trying to do is to display a simple cube within Java3D. Now, I
know, I could use the ColorCube class for this (works fine), but I want to
do it via the GeometryInfo to be able to later on create more complicated
objects. So what I do is to define the 8 vertices of a cube to be
(0,0,0),(0,0,1),... up to (1,1,1), pass this set of coordinates to the
GeometryInfo, triangulate, generate normals, stripify and create a Shape3D
from it. Code is as follows:
GeometryInfo gInfo=new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
gInfo.setCoordinates(mCoords);
int[] ii={mCoords.length/3};
gInfo.setStripCounts( ii);
Triangulator tri=new Triangulator();
tri.triangulate(gInfo);
NormalGenerator normGen=new NormalGenerator();
normGen.generateNormals(gInfo);
Stripifier strip=new Stripifier();
strip.stripify(gInfo);
Shape3D shape=new Shape3D();
shape.setGeometry(gInfo.getGeometryArray());
However, when I display the Shape3D, I get a bunch of triangles and not the total
cube. Now I first thought that some of the faces where backface
culled, so I set the PolgonAttributes correspondingly:
Appearance app=new Appearance();
PolygonAttributes pAtt=new PolygonAttributes();
pAtt.setCullFace(PolygonAttributes.CULL_NONE);
pAtt.setBackFaceNormalFlip(true);
app.setPolygonAttributes(pAtt);
Material mat=new Material();
mat.setAmbientColor(0.4f,0.4f,0.4f);
app.setMaterial(mat);
shape.setAppearance(app);
Still, the same effect, only a few triangles show up, not a full cube.
Probably I did misunderstand the way the Triangulator works, can anybody shed light on
this?
Regards
HEIKO
[EMAIL PROTECTED]
===========================================================================
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".