Jump to content
  • Advertisement


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


Efficient vertex format

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

DirectX makes you make a vertex format for you vertex buffer. class VERTEX { vertices normals tex coords }; The problem for me is the way I read in my data (from a 3ds file right now) is in the form of an array of sequential floats (3 a piece representing a vertex). So if I wanted to read (fread) in those values into an array of VERTEX''s, it would also fill up normals and tex coords. On the other hand, I could just use a for loop to just get the vertices, BUT that would require an fread per vertex (very wasteful). Is there a way to stride the structure so I only read in the first 12 bytes (3 floats, the vertex) then skip the other 20 bytes (normals and tex coords, 6 floats)??? "Love all, trust a few. Do wrong to none." - Shakespeare Dirge - Aurelio Reis www.CodeFortress.com Current Causes: Nissan sues Nissan

Share this post

Link to post
Share on other sites
1. DirectX forum

2. Multiple Streams (where supported)

3. Strided Vertices (though can be slower)

4. What''s more important to you, load time or frame rate? If it''s frame rate, then load into a block of temporary memory, then reformat into the more usual interleaved format in another block of memory and free the first block. It really doesn''t take that much longer, particularly if you use better loading methods and stuff like compression.

Simon O''Connor
Creative Asylum Ltd

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!