Hi all,
Sorry if you have previously seen this problem...
I am trying to put an image down as a texture on a rectangle. I've tried
creating the rectangle using both GeometryArray and PointArray but the
textured object never appears!. The rectangle appears fine if there is no
texture. The error is coming from the renderer and is as follows:
javax.media.j3d.IllegalRenderingStateException: Cannot do texture without
specifying texture coords in geometry object.
Help!
Here are the basics of my code.
//Define 4 coord points
Point3f[] parray = new Point3f[4];
parray[0] = new Point3f( 0.0f, 0.0f, 0.0f);
parray[1] = ...
parray[2]
parray[3] = ...
//Create the appearance
Appearance app = new Appearance();
Texture tex = new TextureLoader( some String for the image, this
).getTexture();
app.setTexture(tex);
//Create the shape
Shape3D texshape = new Shape3D();
//Create the Geometry for the shape
PointArray texgeom = new PointArray( parray.length,
GeometryArray.COORDINATES |
GeometryArray.TEXTURE_COORDINATE_2 );
texgeom.setCoordinates(0,parray);
texgeom.setTextureCoordinates(0,parray);
//Apply geometry to shape
texshape.setGeometry(texgeom);
//Apply appearance
texshape.setAppearance(app);
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/