List of usage examples for javax.media.j3d TriangleArray setColors
public void setColors(int index, float colors[])
From source file:AppearanceExplorer.java
Shape3D createTriangleArray() { Point3f pnt[] = new Point3f[3]; pnt[0] = new Point3f(-1.0f, -1.0f, 0.0f); pnt[1] = new Point3f(1.0f, -1.0f, 0.0f); pnt[2] = new Point3f(1.0f, 1.0f, 0.0f); Color3f colrs[] = new Color3f[3]; colrs[0] = red;//from w ww .ja v a2 s . c o m colrs[1] = green; colrs[2] = blue; Vector3f norms[] = new Vector3f[3]; Vector3f triNormal = new Vector3f(0.0f, 0.0f, 1.0f); norms[0] = triNormal; norms[1] = triNormal; norms[2] = triNormal; TriangleArray ta = new TriangleArray(3, GeometryArray.COORDINATES | GeometryArray.COLOR_3 | GeometryArray.NORMALS); ta.setCoordinates(0, pnt); ta.setColors(0, colrs); ta.setNormals(0, norms); return new Shape3D(ta, appearance); }