title: Understanding glTexCoord2f(), glVertex3f() in OpenGL
body: <p>I'm trying to build in OculusRift support into our car simulator software at our institute. Due to the way the simulator software is setup we decided to fix the distortion due to the lenses client side build a display list with OpenGL to run the first tests.</p>
  
  <p>Basically where I'm struggly a bit is understanding how OpenGL does the drawing (for the display list). I used the info from different tutorials and if I understand it correctly the following for-loop would select the coordinates for Tex 0,1,2 do some vignetting and bind it to each vetice. The <code>glBegin(GL_TRIANGLES)</code> would automatically draw triangles out of the vertices.</p>
  
  <p>The coordinates of the vertices are stored in a struct the address <code>ov</code> is pointing to. Additionally we have offsets for each color channel.</p>
  
  <p>Is the following code snipped from a OpenGL viewpoint correct?</p>
  
  <pre><code>ovrHmd_CreateDistortionMesh(pHmd, eyeRenderDesc[eyeNum].Eye, eyeRenderDesc[eyeNum].Fov,
  ovrDistortionCap_Chromatic | ovrDistortionCap_Vignette, &amp;meshData);
  
  ovrDistortionVertex * ov = meshData.pVertexData;
  
  // New compiled distortion-rendering display list
  glNewList(drList, GL_COMPILE);
  
  // Make triangles out of the vertices
  glBegin(GL_TRIANGLES);
  
  for (unsigned int vertNum = 0; vertNum &lt; meshData.VertexCount; vertNum++) {
      // Tex0,1,2 have already been activated
      glMultiTexCoord2f(GL_TEXTURE0, ov-&gt;TanEyeAnglesR.x, ov-&gt;TanEyeAnglesR.y);
      glMultiTexCoord2f(GL_TEXTURE1, ov-&gt;TanEyeAnglesG.x, ov-&gt;TanEyeAnglesG.y);
      glMultiTexCoord2f(GL_TEXTURE2, ov-&gt;TanEyeAnglesB.x, ov-&gt;TanEyeAnglesB.y);
      glColor4f(
      (OVR::UByte)(ov-&gt;VignetteFactor * 255.99f),
      (OVR::UByte)(ov-&gt;VignetteFactor * 255.99f),
      (OVR::UByte)(ov-&gt;VignetteFactor * 255.99f),
      (OVR::UByte)(ov-&gt;TimeWarpFactor * 255.99f));
      glVertex3f(ov-&gt;ScreenPosNDC.x, ov-&gt;ScreenPosNDC.y, 0.5); // z: constant
      ov++;
  }
  
  glEnd();
  glEndList();
  </code></pre>