OpenGL glDrawElements with interleaved buffers

So far I have used glDrawArrays and would like to move on to using the index buffer and indexed triangles. I draw a somewhat complex object with texture lines, normals, and vertex lines. All this data is collected in one interleaved vertex buffer and drawn using calls like (Assuming all hacking is done correctly):

glVertexPointer( 3, GL_FLOAT, 22, (char*)m_vertexData );
glNormalPointer( GL_SHORT, 22, (char*)m_vertexData+(12) );
glTexCoordPointer( 2, GL_SHORT, 22, (char*)m_vertexData+(18) );
glDrawElements(GL_TRIANGLES, m_numTriangles, GL_UNSIGNED_SHORT, m_indexData );

Does this mean that m_indexData also alternates with the indices of my normals and texture coordinates, as well as the standard array of position index? Or does it allow a single linear list of pointers that apply to the entire vertex format (POS, NOR, TEX)? If the latter is true, how can one make the same vertex with different texture coordinates or normals?

I think this question can also be rephrased: if I had 3 separate indexed lists (POS, NOR, TEX) where the last 2 cannot be rearranged in order to use the same index list as the first one, which is the best way to do this.

+3
source share
2 answers

. glArrayElement(3), OpenGL .
, , , , , , . , . , , , , glVertex3fv(), glNormal3fv() glTexCoord3fv()

+5

Source: https://habr.com/ru/post/1704330/