Skip to main content
gamedev.net
🔒 Locked

Vector Buffer Locking.

Started by Dark_Light 1 reply 300+ views
Original Post
Dark_Light
Dark_Light
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.
circlesoft
circlesoft
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.
Dark_Light
Dark_Light
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.