This might not be entirely appropriate as it's c and not c++, but I'm guessing that there are people from both camps here:p I'm trying to read mesh-data from an obj-file in order to draw it using OpenGL and glut. A line from the obj-file might look like this:
v 1.000000 -1.000000 -1.000000
indicating that there's a vertex with coords x=1, y=-1, z=-1. I'm trying to read it like this:
This almost works fine, the y and z coords are read fine, but x is always 0! I haven't really used strtok before, so I'm guessing it has something to do with that. Does anyone have any ideas?
Perhaps you need to use m->vertices[++v_index] instead of the post-increment? As written, your x is stored in a different element of the vertices array.