• Advertisement
Sign in to follow this  

D3D10: Dynamic Vertex Buffer Questions

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

Hello there! :) I have two simple questions about dynamic vertex buffers. I am trying to implement Stencil Shadow Volumes in my Direct3D 10 3D Engine and I think that I should use a dynamic vertex buffer for the shadow volume geometry. But here they come my questions... 1)what data should I push in the vertex buffer the first time I create it? 2)During vertex buffer creation, which u do it once, you must define the size of the data you send. Most of the times you build the vertex data of a shadow volume, the number of vertices change(if the light position changes). Isn't this a problem? The Map() or Unmap() (lock()/unlock() equivalent for D3d9 I think..) functions does not require the new number of vertices. Thanks for your time!

Share this post


Link to post
Share on other sites
Advertisement
Vertex buffer size can't be modified. If you want to increase (or decrease) vertices, you have to delete old vertex buffer and create another one by new.

You can use also Geometry Shaders to reach this purpose, without recreating vertex buffer.

The D3D10_USAGE_DYNAMIC means only that you can modify buffer's values.

Share this post


Link to post
Share on other sites
You don't have to put data into the vertex buffer when you create it. Just pass NULL as the data in the creation function.

As Vincent said, the vertex buffer size is fixed. If possible, just create a vertex buffer large enough for your needs. If the size varies enough that you don't know that, you can start with a size that's big enough, then release and create a bigger buffer if you need it, with extra space. Minimise the number of such reallocations.

The ShadowVolume10 sample in the SDK shows how to create a shadow volume in a geometry shader.

Share this post


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

  • Advertisement