I have this problem. I need put a texture 32x32 (square) on a rectangle (32x3 x 32 )

  glTexCoord2f(0.0f, 0.0f);	
  glVertex(VERT[0] ); 
  glTexCoord2f(1.0f, 0.0f);
  glVertex(VERT[1] );
  glTexCoord2f(1.0f, 1.0f);	
  glVertex(VERT[3] );
  glTexCoord2f(0.0f, 1.0f);			
  glVertex(VERT[2] );

this code works, but the sqaure texure is strech on rectangle…I’d like repeat the 32x32 texture 3 times on rectangle. HOw ca I do? Thanks

You need to use values larger than 1.0f in your calls to glTexCord2f() if you want to wrap. You can also control wrapping with glTexParamteri(), for example, if you want black displayed instead of wrapping or streching.

glTexCoord2f(6.0f, 6.0f);
glVertex3f(vert1, vert2, vert3);

So if you wanted it repeated 32 times, use glTexCoord2f(32.0f, 32.0f);

eg I’ve got a rettangle 1x3 units; my texture is 1x1 units; I need repeat this texture 3 times on rectangle to don’t stretch or shrink;
Furtermore: I have a rectangle 2x3 units; I need repeat texture 6 times on this rectangle; dimension of rectanggle can be nxm and I need a way to assigne textCoord in relation to its dimensions (units). How can I do? Thanks

With using some simple maths (like Joe said) and your brain :slight_smile: