Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Efective 3ds file loading to Vertex/Index buffers

This topic is 5943 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

I have a fully funcitonal 3ds loader (works fine in OGL) and I am trying to make it effectively load the 3ds into Vertex and Index Buffers. So in other words we have to load all the objects in to Vertex and Index Buffers. Well, that's not the hard part, but I decided to do something a little, well, 'funny'. I load all the vertices of the entire model into 1 vertex and 1 index buffer. So I go through all the vertices of every object and load them (effectively) into 1 Vertex Buffer, then do the same for the Index buffer. Now I hold an offset into the places where the objects should be, so lets say object 1 has 10 vertices and object 2 has 20 vertices, object 3 starts at vertex 30, right? Cool. No, not cool, it doesn't work with more than 1 objects. With just 1 object it works just fine, but the system doesn't seem to work with multiple objects, which has many offsets. I use DrawIndexPrimitive() to draw an object starting at at the vertex and index offset and drawing the number of faces that object has. Should work, right? Any insight into why it isn't? I can post source for anyone that cares to read it. Oh, and the reason I decided to use just 2 great big buffers for vertices and indices is because it is just generally faster, both at creation time, and run-time (for instance, I use just one setstream). Thanks for any help! "Love all, trust a few. Do wrong to none." - Shakespeare Dirge - Aurelio Reis www.CodeFortress.com [edited by - Dirge on July 16, 2002 2:44:06 AM]

Share this post

Link to post
Share on other sites
r u using DX8 or older version (or else r u using OGL???)?

If ur using DX8, did u set the BaseVertexIndex (during SetIndices() call )correctly to offset the first objects vertices while drawing second object?
Also if ur drawing the entire buffer in one single call (which i don''t think is the case, anyway...) then add the num_verts of first object to every index value in the second object indices. This should set the second object indices to correctly point to the second object''s vertices. u''ll have to do the same calculation for the third indices taking into account of the first and second object''s num_vertices.

hope this helps!

ps: if this doesn''t help, u can elaborate on the exact steps ur performing for the loading and rendering, then i can understand the problem better. I''m doing a similar one in my code, but not from a 3ds file.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!