Quote:f 1/2/3 4/5/6 7/8/9
I render the vertices defined at 1, 4 and 5 in my vertex vector, so lets say I have tehse vertices:
v -0.500000 -0.500000 0.000000
v 0.500000 -0.500000 0.000000
v -0.500000 0.500000 0.000000
v 0.500000 0.500000 0.000000
v -0.500000 -0.500000 1.000000
v 0.500000 -0.500000 1.000000
v -0.500000 0.500000 1.000000
v 0.500000 0.500000 1.000000
I draw the following:
v -0.500000 -0.500000 0.000000
v 0.500000 0.500000 0.000000
v -0.500000 -0.500000 1.000000
in that order. It has worked for me so far even with complex models so I don't think thats the wrong way to do it.
When exporting an obj without texture coordinates f is followed by single numbers without /'s so I assum ehte /'s have something to do with textures. I'm just not sure what, how am I supposed to use them in OpenGL to get an accurate texture map?
You are still confusing the concept of a vertex, and the attributes of that vertex. A vertex is not a position in space. A vertex *has* a position in space. It can also *have* a normal, a texture coordinate, a color, etc. When you only have position as a an attribute, then yes, there happens to be a 1-1 mapping between the vertex and its position. When you mix in other attributes, as you have seen, this mapping breaks down. The vertices are defined by the f entries, so let's take a look:
f 1/2/3 4/5/6 7/8/9 v0 v1 v2
The first vertex, v0, has three attributes. It has a position attribute, which is the position stored in the first element of the position list. It has a texture coordinate which is stored in the second element of the texture coordinate list. It has a normal attribute which is stored in the third element of the normal list. All three of these attributes make up 1 vertex. v1 and v2 are defined in the same manner.
Now, it can happen that there is a 1-1 mapping between a vertex and all of its attributes:
f 1/1/1 2/2/2 3/3/3
In this instance, all attributes have the same index into their corresponding lists. That means you can use a single index buffer and render them in the manner that you are trying to do. However, in your case, there is no such 1-1 mapping. So what you need to do is reorganize the lists so that there *is* a 1-1 mapping. That will require reordering some of the elements, and it will require duplicating some of the position information.
[Edited by - CodeMunkie on January 18, 2008 2:15:00 PM]