[SOLVED] How do you set texture coordinates?

I looked through the documentation, and couldn’t find how to set theese.
I think you have to use VertexBuffer buf = mesh.getBuffer(VertexBuffer.Type.TexCoord);But i’m not sure. Could you please help me?

https://wiki.jmonkeyengine.org/jme3/advanced/custom_meshes.html

Edit: alternately, the JME source code is on click away and you can look at how the JME built in shapes like Quad do it.

Can/How do I set it to repeat the texture instead of stretch it?
EX: This is supposed to be a rope…
ropefail
Would I have to rewrite scaleTextureCoordinates ?

You may need to set the edge mode to repeat on the texture itself.

Would that mean I have to get rid of my .j3m definition, because I cant find any of thoose options available using Lighting.j3md

I said texture, not material. You know, the thing you do material.setTexture(“something”,texture) with.

:stuck_out_tongue:

https://javadoc.jmonkeyengine.org/com/jme3/texture/Texture.html

WrapMode.Repeat should be the setting.

No, I was saying /i had the texture defined in the material.

What, like in a j3o thing using the SDK? Then you can probably set that parameter using that as well I guess.

Ok, I’ll check that out, if not, i can probably retrieve the texture from the material and set it

If you mean the material editor then yeah, where you set the texture there is a tick box called “repeat”

That you can, indeed.

I didn’t even see that.
But this still works anyway.

Texture tex = mat.getTextureParam(“DiffuseMap”).getTextureValue();
tex.setWrap(WrapMode.Repeat);
tex = mat.getTextureParam(“NormalMap”).getTextureValue();
tex.setWrap(WrapMode.Repeat);
Screenshot (81)
Thanks everyone

1 Like