Texture Problems !

Hey guys ! i have got a big problem with texturing a simple box. My texture seems to be stretched out over the surface!! i use an image for my texture which 128x128 pixel. Now i have read something about Quadarrays ! But i really dont understand what a quadarray IS or what it is doing! ???

it would be awesome if i show you my code and someone could help me to implement a quadarray!!! :slight_smile:

this is my code

Appearance wallApp = new Appearance();
	 
	    Texture mauer = new TextureLoader("mauer.jpg", frame).getTexture();
	   
	    //ground links
	   
		TransformGroup tgLeft = new TransformGroup();
		Transform3D t3Left= new  Transform3D();
		Vector3f min = new Vector3f(-1.72f, -0.55f, -4f);
		t3Left.setTranslation(min);
		boxapp.setTexture(grass);
		
		Box left = new Box(1.5f,0.005f,6f,Box.GENERATE_TEXTURE_COORDS,wallapp);
		tgLeft.setTransform(t3Left);
		tgLeft.addChild(left);
		RootBg.addChild(tgLeft);

and this is an example i have found

 QuadArray plane = new QuadArray(4, GeometryArray.COORDINATES
 | GeometryArray.TEXTURE_COORDINATE_2);
 Point3f p = new Point3f();
 p.set(-1.0f, 1.0f, 0.0f);
 plane.setCoordinate(0, p);
 p.set(-1.0f, -1.0f, 0.0f); 
 plane.setCoordinate(1, p);
 p.set( 1.0f, -1.0f, 0.0f);
 plane.setCoordinate(2, p);
 p.set( 1.0f, 1.0f, 0.0f);
 plane.setCoordinate(3, p);
 Point2f q = new Point2f();
q.set(0.0f, 1.0f);
 plane.setTextureCoordinate(0, q);
 q.set(0.0f, 0.0f);
 plane.setTextureCoordinate(1, q);
 q.set(1.0f, 0.0f);
 plane.setTextureCoordinate(2, q);
q.set(1.0f, 1.0f);
 plane.setTextureCoordinate(3, q);

okay thats it! now i have to modify this quadarray?! what do I need ? the size of my Box(1.5f,0.005f,6f)?? the Coordinates of my box( -1.72f, -0.55f, -4f) ?? please help me =(

thanks in advance
david

Hi

Please rather ask questions about Java3D on its official forum and check whether you use the very latest version (currently 1.6.0 pre 11), the instructions are available here.

In my humble opinion, you should rather modify the boundary mode (S & T) of the texture object to get the desired effect, see Texture.setBoundaryModeS() and Texture.setBoundaryModeT().

Edit.: Please mention that you use Java3D in order to avoid other newbies to give you unsuitable solutions.

Edit.2: I don’t want to annoy anybody but the main maintainer of Java3D isn’t on Java-Gaming.org whereas he is on the official JogAmp forum. It’s more convenient for us (JogAmp) to answer questions on our forum.