I am currently trying to write a program which takes a mesh as input (consisting of vertex positions and an element array) and outputs indices for use with glDrawElements()
in GL_TRIANGLES_ADJACENCY
mode.
It occurred to me when trying to write the code that non-closed meshes have triangles which may not have three neighbours. For example, a mesh consisting of a single triangle has no neighbouring triangles.
In this case, what should the indices 2, 4 and 6 be? It seems like there should be a standard way to tell the geometry shader that one or more of the adjoining triangles do not exist. I could not find information on this in the OpenGL specification (v4.3), however.
The single triangle is a daft example, but there are plenty of meshes where not all triangles join onto three others - like a cylinder with open ends, for example.
Is there a standard way to handle cases like this? Apologies if I have missed something obvious in the spec.
Above image copied from the OpenGL 4.3 specification.