Argh!

I am trying to get a 64x64 texture to repeat on a box where each face is size 128x128. Ideally you should be able to see the texture repeat 4 times on each face. Yet all i can get it to do is strech fo fit the face no matter what size I make it.


box = new Box("Block", new Vector3f(0,0,0), new Vector3f(128f,256f,128f));
      rootNode.attachChild(box);
      
      TextureState ts = display.getRenderer().getTextureState();
      ts.setEnabled(true);
      
      Texture  t1 = new Texture();
      t1.setWrap(Texture.WM_WRAP_S_WRAP_T);
      t1 = TextureManager.loadTexture(
         Main.class.getClassLoader().getResource(
         "data/tile.jpg"),
         Texture.MM_LINEAR,
         Texture.FM_LINEAR,
         true);
      
      ts.setTexture(t1, 0);
      
      box.setRenderState(ts);


I assume it has to do with the wrap, but nothing seems to change when i edit these values. Am I doing it in the wrong order? Am I forgeting to update it somewhere? Or am I on the wrong track altogether? :?

What you need to do is set your texture coordinates to be outside the [0, 1] range. if they were [0, 2] for example, the texture will be repeated twice in each direction.

so if i use a trimesh, do i need to set the texture coord to 2 for each coord?

you’d want to multiply each texture coordinate by 2 actually.