You should de either one of the followings: 1) set texture coordinates for your TriangleFanArray 2) specify a TexCoordGeneration object for your appearance.
Cheers, Florin -----Original Message----- From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED] Behalf Of Russell East Sent: Donnerstag, 1. April 2004 03:05 To: [EMAIL PROTECTED] Subject: Re: [JAVA3D] Textures Hello, did you ever get an answer for this? I see the same thing. -- Russell Seatizen wrote: >Hello. >There is an example of creating shapes using TriangleFanArray class in the >Java3D Sun Tutorial - YoyoApp.java: > ... > TriangleFanArray tfa; > int N = 17; > int totalN = 4*(N+1); > Point3f coords[] = new Point3f[totalN]; > int stripCounts[] = {N+1, N+1, N+1, N+1}; > float r = 0.6f; > float w = 0.4f; > int n; > double a; > float x, y; > > // set the central points for four triangle fan strips > coords[0*(N+1)] = new Point3f(0.0f, 0.0f, w); > coords[1*(N+1)] = new Point3f(0.0f, 0.0f, 0.0f); > coords[2*(N+1)] = new Point3f(0.0f, 0.0f, 0.0f); > coords[3*(N+1)] = new Point3f(0.0f, 0.0f, -w); > > for(a = 0,n = 0; n < N; a = 2.0*Math.PI/(N-1) * ++n){ > x = (float) (r * Math.cos(a)); > y = (float) (r * Math.sin(a)); > coords[0*(N+1)+n+1] = new Point3f(x, y, w); > coords[1*(N+1)+N-n] = new Point3f(x, y, w); > coords[2*(N+1)+n+1] = new Point3f(x, y, -w); > coords[3*(N+1)+N-n] = new Point3f(x, y, -w); > } > > tfa = new TriangleFanArray (totalN, >TriangleFanArray.COORDINATES, stripCounts); > ... > Shape3D dach = new Shape3D(tfa, appear2); > >I added it to the scene graph and my question is: how can i put a texture on >it? >I've tried to do it: > String filename = "bud1.jpg"; > TextureLoader loader = new TextureLoader(filename, this); > ImageComponent2D image = loader.getImage(); > Texture2D texture = new Texture2D(Texture.BASE_LEVEL, >Texture.RGBA, > image.getWidth(), image.getHeight()); > texture.setImage(0, image); > appear2.setTexture(texture); > >And the result is: one color cover. >Greetings... >[EMAIL PROTECTED] > >=========================================================================== >To unsubscribe, send email to [EMAIL PROTECTED] and include in the body >of the message "signoff JAVA3D-INTEREST". For general help, send email to >[EMAIL PROTECTED] and include in the body of the message "help". > > > =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".