Archived

This topic is now archived and is closed to further replies.

Dwiel

why lock Vertex buffers?

Recommended Posts

Dwiel    365
My question is very basic.... I want to say, edit a few of the verticies in my VB, now why do I need to call the VB->lock and VB->unlock ? Why cant I just acces the VB directly? Also what would be the easiest way to change for ex. just one vertex in the Buffer? Thanx SOOOOOOOOOOOOOOOOO much for the help.... Zach Dwiel

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Also, the lock/unlock process lets the card know it can precompute vertex transforms so it can do less work later. That way processing is done only when things change, not every time vertexes are displayed.

Share this post


Link to post
Share on other sites
Sorrow    122
locking the vertex buffer IS accessing the vertex buffer directly. The act of locking it gives you a pointer to the vertex buffer memory... and unlocking it gives the pointer back. This gives DX the freedom to do lots of things you can't see... like changing where the vertex buffer is located in memory, buffering that vertex memory (a common case), etc. It also protects the system from concurrency conflicts (you trying to write to the buffer while DX is trying to render from it... imagine the mess :o )

But anonymous... I don't think there's any precomputing of vertex transforms... that doesn't happen till you start pushing triangles.

[edited by - sorrow on March 19, 2002 12:51:30 PM]

Share this post


Link to post
Share on other sites
Dwiel    365
i have heard that locking and unlocking the VB is a slow proccess, and if I wanted to change one vertex, then I would still have to use this prosecc?

Well... unhappy news but thatnx for info!!

Tazzel3d ~ Zach Dwiel

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
quote:
Original post by Sorrow


But anonymous... I don''t think there''s any precomputing of vertex transforms... that doesn''t happen till you start pushing triangles.




If you''re rendering the same stuff every frame, and directX knows this, then it doesn''t have to recompute some of the math every frame.

At least, if the underlying drivers have been written to take advantage it''ll do that.

Share this post


Link to post
Share on other sites