Vertex and Index Buffer in OBJ File

Started by
1 comment, last by haegarr 12 years, 11 months ago
Hi,

I am programming a OBJ Loader and I have a question.

I can create the Vertex Buffer perfectly without Index Buffer but now I want to create the vertex buffer and the index buffer.

For example for a cube with texture and normals in DirectX I need 36 vertices without indices and with indices would be 24 vertices and 12 indices but in an OBJ file I have only 8 vertices with 24 normals and 24 textures coordinates.

How can I create the Vertex Buffer with the 24 vertices and the Index Buffer?? :(

Thank you
Advertisement
Duplicate the positions so you end up with 24 vertices.

...
How can I create the Vertex Buffer with the 24 vertices and the Index Buffer?? :(

An OBJ file provides indexing, too, with the difference to a hardware IB in that OBJ can index each vertex attribute separately. For an optimal conversion (w.r.t. the count of vertices) you need to determine the set of unique combinations of indices from OBJ, compose hardware friendly vertices for each newly found combination, and use the index of the newly generated vertex for the hardware IB.

This topic is closed to new replies.

Advertisement