I've loaded a Wavefront .obj file and drawn it in immediate mode, and it works fine.
I'm now trying to draw the same model with a vertex buffer, but I have a question.
My model data is organized in the following structures:
struct Vert
{
double x;
double y;
double z;
};
struct Norm
{
double x;
double y;
double z;
};
struct Texcoord
{
double u;
double v;
double w;
};
struct Face
{
unsigned int v[3];
unsigned int n[3];
unsigned int t[3];
};
struct Model
{
unsigned int vertNumber;
unsigned int normNumber;
unsigned int texcoordNumber;
unsigned int faceNumber;
Vert * vertArray;
Norm * normArray;
Texcoord * texcoordArray;
Face * faceArray;
};
As it is now, I don't think there is any redundant data, since multiple face structures can point to the same vertex, normal, or texture coordinate.
When I make vbo's for the vertex positions, normals, and texture coordinates, and assign data to them with glBufferData, do I have to have make arrays with redundant data so that they will all have the same number of elements in the same order? I'd like to know if there is a simpler way to fill the buffers with the way I already have the model's data organized.