Texture usage

I would like to create a board with textures.

It is composed by cubes side by side (7x7). But rahter than creating as many cubes as cells in the board i would like to create a box with te right size an apply correctly a texture to repeat the pattern of the cells.



The problem is that i do not know how to manipulate textures coord.

here is what i've done :



Node boardNode=null;
boardNode= new Node("MyBoardNode");
Box b = new Box("BoardBox", new Vector3f(0, 0, 0), 3.5f, 3.5f, .5f);
boardNode.attachChild(b);
URL textu=DiceUI.class.getClassLoader().getResource("resources/models/board.bmp");
TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
ts.setEnabled(true);
Texture texture = TextureManager.loadTexture(
   textu,
   Texture.MM_LINEAR,
   Texture.FM_LINEAR);
   ts.setTexture(texture);
boardNode.setRenderState(ts);
TextureManager.releaseTexture(texture);
diceNode.updateRenderState();



of course, it's not working.

How about doing the board in a graphics modeller and import it into jme ?

Wings3D is a brilliant free solution for static models btw.

Because it's only a problem of texture mapping.  The geometric part is already done with a simple box.

Ok, for me box seems not to be Your optimal solution here.

Here's what the doc's stat about box's texture coord gen:

[pre]

/**

*

  • <code>setTextureData</code> sets the points that define the texture of
  • the box. It's a one-to-one ratio, where each plane of the box has it's
  • own copy of the texture. That is, the texture is repeated one time for
  • each six faces.



    */

    [/pre]

    so if i get this right, You would get a box with the assigned texture (checkerboard) repeated  on each side of the box (scaled to fit).

    If thats not what You want, i'd be creating my own box class holding four quads with different textures like skybox or simply add a quad with the checkerboard texture slightly above the box.



    hth

    Martin


Ok i've worked with milkshape3D,



I've used the tiled texture tools to generate the texture mapping



and modify my code as follow :



texture.setWrap(Texture.WM_WRAP_S_WRAP_T);



Thanks very much

glad to help :slight_smile: , it was the easyer way.



But You were right and it should be doable by manipulating the texture coords of the box too.

Youd would have to find the order in which the verts are indexed and

set new tex coords with Box.setTextures(…) in the retrieved order.

Additionally You would have to use a texture with the checkerboard with maps on the top side

and some seam to map on all the other sides (and fiddling with the coords of couse).

Thanks very much, once again, for your help.