title: OpenGL - Index buffers difficulties
body: <p>I have a custom file format that has all the needed information for a 3D mesh (exported from 3ds Max). I've extracted the data for vertices, vertex indices and normals.</p>
  
  <p>I pass to OpenGL the vertex data, vertex indices and normals data and I render the mesh with a call to          <code>glDrawElements(GL_TRIANGLES,...)</code></p>
  
  <p>Everything looks right but the normals. The problem is that the normals have different indices. And because OpenGL can use only one index buffer, it uses that index buffer for both the vertices and the normals.</p>
  
  <p>I would be really grateful if you could suggest me how to go about that problem.</p>
  
  <p>Important thing to note is that the vertex/normal data is not "sorted" and therefore I am unable to use the functionality of <code>glDrawArrays(GL_TRIANGLES,...)</code> - the mesh doesn't render correctly. </p>
  
  <p>Is there a way/algorithm that I can use to sort the data so the mesh can be drawn correctly with <code>glDrawArrays(GL_TRIANGLES,..)</code> ? But even if there is an algorithm, there is one more problem - I will have to duplicate some vertices (because my vertex buffer consists of unique vertices - for example if you have cube my buffer will only have 8 vertices) and I am not sure how to do that.</p>