Hi Gregg,

There's an example of how to do this in the You Built It VR code (see my .sig
at the bottom of this e-mail for the URL).  Look in the file
contest/parts/EastWest.java in combination with the method "setTexture" in
contest/parts/PositionedElement.java.

Hope this helps...

Steve

"Hock, Gregg" wrote:

> 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/

--
Steve Pietrowicz - [EMAIL PROTECTED]    Project Manager - NCSA Java 3D Group

NCSA Portfolio:      http://havefun.ncsa.uiuc.edu/Java3D/portfolio/
   New Beta 2a release!  New Loaders, record and replay of your
   Java 3D apps and more! Freely available for non-commercial use!
You Build It VR:     http://havefun.ncsa.uiuc.edu/Java3D/YouBuildItVR/
   Build your own multi-user virtual worlds with no programming experience!
The Java3D FAQ:      http://tintoy.ncsa.uiuc.edu/~srp/java3d/faq.html
Java News Network:   http://tintoy.ncsa.uiuc.edu/~srp/java/javanews.html



=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to