Applying texture to a board


I am just a beginner in jMonkeyEngine. I created a board with a set of four walls. (like an open room) I have a problem with the texture loading. There isn’t any errors, however the outcome is that the image is sort of stretched to produce only one colour or two shades of colours… This is my code:

Mesh board = new Mesh();

board.setBuffer(Type.Position, 3, new float[]{-x/2, 0, -z/2,

x/2, 0, -z/2,

-x/2, 0, z/2,

x/2, 0, z/2 });

board.setBuffer(Type.Index, 3, new short[] {0, 2, 1,

1, 2, 3 });

Geometry geomBoard = new Geometry(“Board”, board);

Material material = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

Texture floor = assetManager.loadTexture(“Textures/floor.jpg”);


material.setTexture(“ColorMap”, floor);



I am placing my image (which I found on google) in the Assets/Textures folder. I seriously don’t know what I’m doing wrong. Please help! Thanks :slight_smile:

You have no texture coordinates.

What method do I have to use please? And what would I be doing? Thanks for your reply! :slight_smile:[]=custom&s[]=mesh

1 Like

Thanks :slight_smile: It worked now!