Archived

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

lock a vertexbuffer,i failed.

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

I can''t lock a vertexbuffer use Lock(0,0,p,D3DLOCK_DISCARD); The vertexbuffer created by D3DUSAGE_WRITEONLY. It''s ok when change to the Lock(0,0,p,0); but i can''t find what''s means to set the D3DLOCK_CARD to zero. which lock parameter is better.

Share this post


Link to post
Share on other sites
Quote from the SDK:

"The D3DLOCK_DISCARD and D3DLOCK_NOOVERWRITE flags are valid only on buffers created with D3DUSAGE_DYNAMIC."

Dynamic buffers can move in the gfx memory for speed optimization. The Discard flag tells the driver that you don't care, since you don't need the old data anymore, and therefore potentially makes the lock faster.

Note that not all hw support dynamic vb:s.

-Nik

EDIT: Lock parameter 0 simply uses the default lock settings (RW, non-dynamic, blocking).

[edited by - Nik02 on November 12, 2003 4:17:32 AM]

Share this post


Link to post
Share on other sites