Sign in to follow this  

adding and removing vertices from vertexbuffer

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

You don't. The size of a vertex buffer is fixed once it's created, and you can't resize it.

What you should do instead is simply keep track of how many vertices you have copied into a vertex buffer at any given time, that way you can specify the appropriate information when you make a Draw call.

Share this post


Link to post
Share on other sites
so, i want to remove a vertex from a buffer. if i cant resize or remove vertices i have to create either a new vertex buffer or use multiple vertex buffers? Is there not a more efficient way to manage this? i can imagine lots of creation and destruction of objects doing that, let alone the device state switches.

Share this post


Link to post
Share on other sites
Quote:

so, i want to remove a vertex from a buffer. if i cant resize or remove vertices i have to create either a new vertex buffer or use multiple vertex buffers? Is there not a more efficient way to manage this? i can imagine lots of creation and destruction of objects doing that, let alone the device state switches.

It is not possible. It would be just as inefficient to resize the buffer directly as it would be for you to recreate it (within some reasonable, but negligible, margin of error).

Instead, as MJP said, you want to simply write to only a portion of the buffer, and keep track of what you have written so you specify only that many vertices should be used when drawing.

Share this post


Link to post
Share on other sites
hmmm...

In your opinion(s) would using a single vertex buffer( created with a large size ) to store all vertices in a scene be a good idea or should i choose to create individual buffers for each object? Which is optimal?

I'm in the process at the moment of implementing batch rendering and need to weigh up the options here.

Any advice would be very much appreciated!

Share this post


Link to post
Share on other sites
damn, i dont want to use that! lol

or i can just use drawindexedprimitive using D3DPT_TRIANGLELIST which is what D3DXMESH uses for drawsubset() as i have just found out. hmmmm maybe i am overcomplicating this.

Share this post


Link to post
Share on other sites

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