Hi!
The mesh seems to need a uv coordinate per vertice. Is it true that I need 4 vertives per 2-triangle Quad, and cannot re-use the vertices? So I need to have 4 identical vertices at each point of the mesh? (or did I oversee something^^) Thanks for you answer!
You need four vertexes at the same location if four different primitives share that location and those primitives require the location to have its own texture coordinate unique to that primitive. It’s not always four, though. For example, a cube only has three vertexes at the same location.
A unique “vertex” in this case, includes any attributes associated with the vertex. If the position, normal, texture coordinate, tangent, etc. are all the same then it can be shared (like the ones shared between the two triangles of a quad) but if any of them are different then it is really a different vertex even if it shares the same position with another one.
@pspeed Please, add this hint to the docu! I have wasted several hours to reduce the number of vertices. And at the end I realized, that the texCoords are not dependent on the indexes but the vertices >.<
The docu only contains: “If the corners are identical, you can (and should!) reuse an index for several triangles.”
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_meshes
@alrik said: @pspeed Please, add this hint to the docu! I have wasted several hours to reduce the number of vertices. And at the end I realized, that the texCoords are not dependent on the indexes but the vertices >.<The docu only contains: “If the corners are identical, you can (and should!) reuse an index for several triangles.”
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_meshes
Well… the corners were not identical, then.
I don’t maintain the docs. The community does. And anyway, at some point you have to rely on someone already having some basic 3D knowledge so it’s tough to decide how far to go. We could include three or four pages at the top of every article discussing the OpenGL pipeline, vertexes, vertex attributes, etc… but I don’t think people would read it anyway and it’s kind of overkill.
Perhaps a link to one of the four or five hundred “beginning OpenGL” web pages could be useful in the “advanced” sections like custom meshes. Hard to tell where to stop, really.