import com.sun.j3d.utils.geometry.GeometryInfo; import com.sun.j3d.utils.geometry.NormalGenerator; import com.sun.j3d.utils.geometry.Stripifier; import com.sun.j3d.utils.geometry.Triangulator; GeometryInfo gi = new GeometryInfo( GeometryInfo.POLYGON_ARRAY ); int strips = vertexCount/4; int stripRemain = vertexCount%strips; int stripCount[] = new int[strips+1]; for ( int i=0; i < stripCount.length; i++ ) stripCount[i] = 4; stripCount[stripCount.length-1] = stripRemain; gi.setCoordinates( gridPoints ); gi.setStripCounts( stripCount ); Triangulator tr = new Triangulator(); tr.triangulate(gi); gi.recomputeIndices(); NormalGenerator ng = new NormalGenerator(); ng.generateNormals(gi); gi.recomputeIndices(); Stripifier st = new Stripifier(); st.stripify(gi); gi.recomputeIndices(); // Wireframe look Appearance look = new Appearance(); PolygonAttributes polyAttrib = new PolygonAttributes(); polyAttrib.setPolygonMode( PolygonAttributes.POLYGON_LINE ); look.setPolygonAttributes( polyAttrib ); ColoringAttributes colorAttrib = new ColoringAttributes(); colorAttrib.setColor( 0.5f, 0.5f, 0.5f ); look.setColoringAttributes( colorAttrib ); testShape.setAppearance( look ); testGeom = gi.getGeometryArray(); testShape.setGeometry( testGeom ); TransformGroup xfGroup = new TransformGroup(); xfGroup.addChild(testShape); testGroup.addChild(xfGroup); // sceneRoot.setCapability( Group.ALLOW_CHILDREN_EXTEND ); sceneRoot.addChild( testGroup );