Jump to content
  • Advertisement
Sign in to follow this  
johnnyBravo

Creating vertex/index buffers, pool, format questions..

This topic is 4810 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've got a few questions on creating vertex and index buffers. When setting the pool, Should I use D3DPOOL_MANAGED when my vertices/indices are going to be pretty much static? And use D3DPOOL_DEFAULT when they are dynamic? Also would the ever be a reason to use D3DPOOL_SYSTEMMEM or D3DPOOL_SCRATCH? With the format variable with the indexbuffer creation, i'm currently using D3DFMT_INDEX16, but when would I need to use D3DFMT_INDEX32? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by johnnyBravo
Hi I've got a few questions on creating vertex and index buffers.

When setting the pool,
Should I use D3DPOOL_MANAGED when my vertices/indices are going to be pretty much static?

And use D3DPOOL_DEFAULT when they are dynamic?

Yep, that is right. If you need to overwrite the vertices every frame, make it default pool with dynamic usage.

Quote:

Also would the ever be a reason to use D3DPOOL_SYSTEMMEM or D3DPOOL_SCRATCH?

The scratch pool isn't used that much. However, in some situations, it can be particularly helpful, since it can utilize all formats supported by the runtime. Keep that in mind, I guess. Otherwise, you really won't run into it that much.

Quote:

With the format variable with the indexbuffer creation, i'm currently using D3DFMT_INDEX16, but when would I need to use D3DFMT_INDEX32?

If you have large models, you are probably going to run into this quite a bit. Since 16 bit indices store their index data in 2 bytes (ie a short or WORD), the maximum number of vertices rendered at once is 65,536 (IIRC). If you have more vertices than that, switch to 32 bit indices (which will give you 4 bytes of storage [ie an int]).

Share this post


Link to post
Share on other sites
Just to add to circlesoft's reply, you'll almost always want to use the managed pool, unless you're using a dynamic resource. the D3DUSAGE_DYNAMIC flag can't be used with managed resources, so you'd use the default pool in this case.

I really try to stay away from 32-bit indices as much as possible, and just split my model into several smaller ones. 32-bit indices don't give a maximum index of 0xffffffff, for example my GeForce 4 has a maximum index of 0x000fffff, which doesn't really give that much of a benifit over 0x0000ffff vertices, and your indices will be twice the size. Furthermore, some older cards don't support 32-bit indices at all.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!