Sign in to follow this  
Dark_Light

Vector Buffer Locking.

Recommended Posts

Dark_Light    100
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
circlesoft    1178
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
Dark_Light    100
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

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