I'm trying to understand vertex arrays but I can't seem to find a good tutorial on how to implement them.
I have the following structures.
struct MeshVertex
{
float x , y , z;
};
struct MeshTextureCoord
{
float u , v;
};
struct MeshFace
{
unsigned int a , b , c;
};
MeshVertex* m_vertices;
MeshVertex* m_normals;
MeshTextureCoord* m_texturecoords;
MeshFace* m_faces;
Each face is made up of three vertices and each vertex has a texture coord associated with it. However normals are done per face.
m_vertices is indexed by faces .a, .b, and .c
m_texturecoords is indexed by faces .a, .b, .c
m_normals is indexed by faces index.
I know to do the following:
glTexCoordPointer ( 2, GL_FLOAT, 0, m_texturecoords);
glVertexPointer ( 3, GL_FLOAT, 0, m_vertices);
glNormalPointer ( 3, GL_FLOAT, 0 , m_normals);
So when glDrawElements is called how do I get it to handle the way that the normals are indexed?