Texture not visible

I have the following code:
Texture Tex1 = assetManager.loadTexture(“Textures/wall1.png”);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
mat.setTexture(“ColorMap”, Tex1);
lWall.setMaterial(mat);
But while running the code the Texture is not visible. I get only a white color.
What is wrong?

Leo

My guess is that your mesh has no UV coords. But with so few information your post rather looks like a guessing game than a support request.

The full code is :

Box b = new Box(0.1f, 2, 3);
Geometry lWall = new Geometry(“Box”, b);
lWall.setLocalTranslation(new Vector3f(-3,0,0));
lWall.setMaterial(mat);
rootNode.attachChild(lWall);

now, what is wrong in this.

Leo

The mesh has no UV coords, I’m almost sure you mean that. Am I right? Am I right? Did I win?

Can you show us the code cut-and-pasted from your real code instead of shown in two separate parts that were clearly originally mixed together?

What you are trying to do is very simple… like one of the simplest things. So what’s wrong is not directly in what you posted. While you’re at it, post the texture you are using also.

The full code is:
Texture Tex1 = assetManager.loadTexture(“Textures/wall1.png”);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
mat.setTexture(“ColorMap”, Tex1);
Box b = new Box(0.1f, 2, 3);
Geometry lWall = new Geometry(“Box”, b);
lWall.setLocalTranslation(new Vector3f(-3,0,0));
lWall.setMaterial(mat);
rootNode.attachChild(lWall);

The texture is just a jpeg (.jpg) picture.
It is in the Texture folder un der the project’s asset folder

Leo

The full code is:

Texture Tex1 = assetManager.loadTexture(“Textures/wall1.png”);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
mat.setTexture(“ColorMap”, Tex1);
Box b = new Box(0.1f, 2, 3);
Geometry lWall = new Geometry(“Box”, b);
lWall.setLocalTranslation(new Vector3f(-3,0,0));
lWall.setMaterial(mat);
rootNode.attachChild(lWall);

The texture is just a jpeg (.jpg) picture.
It is in the Texture folder un der the project’s asset folder

Leo

Given that code… if the wall is pure white then so is the texture.

@leorius said: The texture is just a jpeg (.jpg) picture.

…by the way, that’s not true. It’s a PNG since that is what you are loading. I hope you haven’t confused two different textures.

Sorry, actually the picture is a .png file only and not .jpg as I mentioned…But still the trexture is not visible

Leo