Accessing TexCoord2 in shaders

Hi All,

I am working on a custom shader but I have one issue. I want to use two sets of texture coordinates, but I am unsure how to access the second set in my vertex shader.

The first set is defined using attribute vec2 inTexCoord;, but I am unsure how to define the second set, my guess was attribute vec2 inTexCoord2; but that does not seem to work…

Hope someone can help.



How does it “not seem to work”? That’s the way to do it.

For example, Unshaded.j3md uses multiple texture coordinates and the JME source is on the web:

So maybe there was something else wrong. We would need to know what errors your saw.

1 Like

I can assure you it works.
Does your mesh actually have a TexCoord2 VertexBuffer?
If you loaded it from the blender importer it may not work, because this feature was implemented recently. From the ogre pipeline it works.

1 Like

Thank you for your replies.

You were right nehon, my TexCoord2 buffer was not correctly set. I had accidentally written into the TexCoord buffer twice…

And sorry, I wasnt more specific about the error. TexCoord2 was null, I just thought that was simply because the name was wrong.