Example usage for javax.media.j3d QuadArray setTextureCoordinates

List of usage examples for javax.media.j3d QuadArray setTextureCoordinates

Introduction

In this page you can find the example usage for javax.media.j3d QuadArray setTextureCoordinates.

Prototype

public void setTextureCoordinates(int texCoordSet, int index, float texCoords[]) 

Source Link

Document

Sets the texture coordinates associated with the vertices starting at the specified index in the specified texture coordinate set for this object.

Usage

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);
}