NOT stretch a texture image?

Hey everyone,

  I am trying to make a maze game. I have a few quads setup for walls and when I setup a texture image, it is stretched over the entire quad. I inserted the following code: t1.setWrap(t1.WM_WRAP_S_WRAP_T);, but that did not help. How can I make it so that the texture image is tiled over the quad? Thanks!

set different texturecoords on the quads, or easier, use setScale on the texture

Personally I'd go with MrCoders first solution, I havent got any code with me to demonstrate - but I tiled the texture using texture coords in relation to the dimension of the quad so that the textures are always the same size for any sized quad. (Not sure if you can scale texture using setScale along x and y differently from one another)



Will post some code when I get home.

I used setscale, it works… However, I want my textures to be a certain size and not related to the side of the quad. For example, I want the texture to look the same on a 50 * 100 quad as a 200 * 200 quad. Thanks again!

Heres how I done it - only my (ortho) quads where the same dimension as the display width and height:



// would have divided the quad width and height by the texture but the quad didnt exist yet.
x = (float) display.getWidth() / texture.getImage().getWidth();
y = (float) display.getHeight() / texture.getImage().getHeight();

floatBuffer = quad.getTextureBuffer(0, 0);
floatBuffer.clear();
floatBuffer.put(0).put(y);
floatBuffer.put(0).put(0);
floatBuffer.put(x).put(0);
floatBuffer.put(x).put(y);



Hope that helps