[SOLVED] How do you set texture coordinates?


#1

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?


#2

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.


#3

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 ?


#4

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


#5

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


#6

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.


#7

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


#8

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


#9

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


#10

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


#11

That you can, indeed.


#12

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