title: How do I get indexed vertex positions AND indexed vertex normals from wavefront .obj file into an OpenGL vertex shader?
body: <p>I was trying to use two Vertex Buffer Objects (VBO) and two Index Buffer Objects (IBO) in a Vertex Array Object (VAO) for rendering data from a wavefront .Obj file containing a 3D model.
  The .obj file was using the <a href="http://en.wikipedia.org/wiki/Wavefront_.obj_file#Vertex.2Fnormal" rel="nofollow">vertex/normal face definition</a>:</p>
  
  <pre><code>f v1//vn1 v2//vn2 v3//vn3
  </code></pre>
  
  <p>I realized that I couldn't use two IBOs for indexing with OpenGL's VAO since only one buffer object (at a time) can be bound to the GL_ELEMENT_ARRAY_BUFFER binding target. This means that I can't just define vertex position indices AND vertex normal indices which is a problem when I need both as input to a GLSL vertex shader.</p>
  
  <p>I thought about using a "Vertex" struct encapsulating vertex position and vertex normals, but I don't know how to feed OpenGL the data as anything but one long array and when I have all my vertex position data in different objects. I guess I could use some loops to copy the data to a new array containing all the position data.</p>
  
  <p>When loading the .obj file I guess I could process the data so that the normals are matched with the corresponding vertex position values. </p>
  
  <p>How should I go about solving this problem?</p>
  
  <p>I'm using C++ and Visual Studio 2012 with OpenGL 3.3.</p>