Vertex Buffer Object - usage HELP!

Mr.Pink

Newcomer
i want to draw an .obj model in openGL using VBO, but i am confused with "index buffer", "index array" and other legacy functionality.
i cannot found anything clear about that on the web

i wrote an .obj reader, so in my system memory i have this situation

3 STL c++ vector representing data ridden from file

Code:
vector<Vec3>        m_vertexCoords; 
vector<Vec2>        m_textureCoords; 
vector<Vec3>        m_normalCoords;

unsigned int        m_numVertices;
unsigned int        m_numTextures;
unsigned int        m_numNormals;
(Vec* is a class with * float members)


and


Code:
 struct Face
{
    vector<unsigned int> vertices;
    vector<unsigned int> texcoords;
    vector<unsigned int> normals;
};

vector<Face>        m_faces;

unsigned int        m_numFaces;
this vector of faces(triangles) each one containing indices to previous vectors of float

can someone tell me how to initialize buffer and draw them each frame? thanks
 
Hi Mr Pink,

It's not clear to me that you need VBOs just yet.

You first need to restructure your data such that you have a single index list instead of a separate index for each vertex attribute. Then you should be able to render using conventional (slow) vertex arrays. There are lots of examples of how to do this.

Once you get your code working with conventional arrays, you'll want to create VBOs to hold the arrays. Again, there are numerous examples (including the VBO extension spec) for how to do this.

Thanks -
Cass
 
Hi Mr Pink,

It's not clear to me that you need VBOs just yet.

You first need to restructure your data such that you have a single index list instead of a separate index for each vertex attribute. Then you should be able to render using conventional (slow) vertex arrays. There are lots of examples of how to do this.

Once you get your code working with conventional arrays, you'll want to create VBOs to hold the arrays. Again, there are numerous examples (including the VBO extension spec) for how to do this.

Thanks -
Cass


can you tell me some sources for tutorials/documentation/code using VBO drawing mesh from a file? thanks again
 
Back
Top