• Advertisement
Sign in to follow this  

Vector Buffer Locking.

This topic is 4836 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 people! I would like to know if there is a way of updating a mesh’s vectors without having to lock it each time. Eg lock it once and then unlock it over and over again with the data I am changing in the locked buffer. Having to lock it and wait for the mesh to write to the buffer is a total waste of time since I will be changing its contents. I could use the SetVectorBuffer method but I have a feeling this would be much slower. So any help would be cool thanks.

Share this post


Link to post
Share on other sites
Advertisement
Unfortunately, no. In order to change the contents of a vertex buffer in software, you must lock it.

How often do you need to modify each mesh? You should try to keep it to a minimum, since locking buffers is one of the most expensive functions in D3D.

If you truly do need to be modifying the VB a lot, make sure to use follow the perormance tips set forth here, in the "Using Dynamic Vertex and Index Buffers" section.

Share this post


Link to post
Share on other sites
The mesh changes around 5 times a second. My point is i only ever want to update it and i am never interested in what it contains.

when i first lock it i get a copy of the data in some memory space. i then update that memory space and unlock it.

that’s fine but the next time when i lock it again i get a new copy of the data and we go around in a circle.

what i want in an ideal world would be.

create mesh.
render it
update the mesh by writing the new data to it
render it
update the mesh by writing the new data to it
...

it just seems like a waste of time reading the mesh contents when i don’t care about it.

Share this post


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

  • Advertisement