List of usage examples for javax.media.j3d QuadArray setTextureCoordinates
public void setTextureCoordinates(int texCoordSet, int index, float texCoords[])
From source file:AppearanceExplorer.java
Shape3D createTexSquare() { // color cube Point3f pnt[] = new Point3f[4]; 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); pnt[3] = new Point3f(-1.0f, 1.0f, 0.0f); TexCoord2f texCoord[] = new TexCoord2f[4]; texCoord[0] = new TexCoord2f(0.0f, 0.0f); texCoord[1] = new TexCoord2f(1.0f, 0.0f); texCoord[2] = new TexCoord2f(1.0f, 1.0f); texCoord[3] = new TexCoord2f(0.0f, 1.0f); QuadArray qa = new QuadArray(4, GeometryArray.COORDINATES | GeometryArray.TEXTURE_COORDINATE_2); qa.setCoordinates(0, pnt);// ww w .j a v a 2 s. com qa.setTextureCoordinates(0, 0, texCoord); return new Shape3D(qa, appearance); }
From source file:AppearanceExplorer.java
Shape3D createLargeTexSquare() { // color cube Point3f pnt[] = new Point3f[4]; 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); pnt[3] = new Point3f(-1.0f, 1.0f, 0.0f); TexCoord2f texCoord[] = new TexCoord2f[4]; texCoord[0] = new TexCoord2f(-1.0f, -1.0f); texCoord[1] = new TexCoord2f(2.0f, -1.0f); texCoord[2] = new TexCoord2f(2.0f, 2.0f); texCoord[3] = new TexCoord2f(-1.0f, 2.0f); QuadArray qa = new QuadArray(4, GeometryArray.COORDINATES | GeometryArray.TEXTURE_COORDINATE_2); qa.setCoordinates(0, pnt);//from ww w. ja v a 2s .com qa.setTextureCoordinates(0, 0, texCoord); return new Shape3D(qa, appearance); }