Sign in to follow this  

Vertex and Index Buffer in OBJ File

This topic is 2391 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
[quote name='cHimura' timestamp='1306388798' post='4815913']
...
How can I create the Vertex Buffer with the 24 vertices and the Index Buffer?? :(
[/quote]
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.

Share this post


Link to post
Share on other sites

This topic is 2391 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this