Hello jmonkeys,
I’ve created a very simple custom quad in my game which is 32x32 (width and height).
I’m trying to apply a texture to it using the UV coords and the used image is also 32x32.
The actual texture of this quad is a very small piece of the image, as it’s a 4x4 area in the top-left corner of it.
I think I’m using the correct UV coords, but there’s a strange behaviour with the pixels of the image (like gradients between near pixels)
I’m using Unshaded.j3md as material.
And this is the strange result:
So in my custom mesh the UV coords are:
texCoord[0] = new Vector2f(0, 1F-(4F/32F));
texCoord[1] = new Vector2f(4F/32F, 1F-(4F/32F));
texCoord[2] = new Vector2f(0, 1);
texCoord[3] = new Vector2f(4F/32F, 1);
And I create my quad with the following code:
Mesh quad = CustomBox.createCustomQuad(32, 32);
Geometry geom = new Geometry("Quad"+this.ID, quad);
Material mat = new Material(MyGame.app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", MyGame.app.getAssetManager().loadTexture("Textures/testBox2.png"));
mat.setBoolean("SeparateTexCoord",true);
geom.setMaterial(mat);
rootNode.attachChild(geom);
What did I do wrong? Is it for the unshaded material?
Thanks for your help and time,
Axel