The IDirect3DVertexBuffer::Lock methods locks a vertex buffer and obtains a pointer to the vertex buffer memory.
HRESULT Lock(
DWORD dwFlags,
LPVOID* lplpData,
LPDWORD lpdwSize
);
If the method succeeds, the return value is D3D_OK.
If the method fails, the return value may be one of the following values:
D3DERR_VERTEXBUFFEROPTIMIZED |
DDERR_INVALIDPARAMS |
DDERR_OUTOFMEMORY |
DDERR_SURFACEBUSY |
DDERR_SURFACELOST |
After locking the vertex buffer, you can access the memory until a corresponding call to IDirect3DVertexBuffer::Unlock.
You cannot render from a locked vertex buffer; calls to the IDirect3DDevice3::DrawIndexedPrimitiveVB or IDirect3DDevice3::DrawPrimitiveVB method using a locked buffer will fail, returning D3DERR_VERTEXBUFFERLOCKED.
This method often causes the system to hold the Win16Mutex until you call the IDirect3DVertexBuffer::Unlock method. GUI debuggers cannot operate while the Win16Mutex is held.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in d3d.h.
Import Library: Use ddraw.lib.
IDirect3DVertexBuffer::Unlock, Accessing Vertex Buffer Memory