Rendering wavefront obj files with VBOs

Here is an example wavefront obj file (I just quickly made it up) that I am trying to render using VBOs:
v 1 0 0
v 0 1 0
v 0 0 1

vt 0 0
vt 1 0

f 1/1 2/1 3/1
f 2/1 1/2 1/1

My vertex buffer contains {1,0,0,0,1,0,0,0,1} with stride sizeof(GLfloat)*3. That way, my index buffer is quickly generated as {1, 2, 3, 2, 1, 1} by just looking at the face definitions (and only looking at the vertex coordinate indices).

I’m not sure how to incorporate texture coordinates into this, as one vertex coordinate can map to multiple texture coordinates. I cannot draw from a texture coordinate buffer {0,0,1,0} with stride sizeof(GLfloat)*2 using the same element buffer that I use for my vertices.

I am unsure how to map each vertex to the correct texture coordinate in an efficient manner using VBOs. I believe interleaving would work with this format: {x, y, z, s, t}, and using an element buffer such as {0, 1, 2, 3, …}, and doing a ton of copying of the vertices. However, this is not very efficient.

Also, as I’m new to this; is there a better format (than obj) I should be using?

Thanks.

You need to copy and repeat the texture coordinates to match the verticies in the VBO according to the face information.
This is not a ‘fault’ of the OBJ format - just the way OpenGL works in that there is only only element/index list.

I was hoping to avoid that, oh well.

Thanks.