Share via


IDirect3DMobileVertexBuffer::Lock (Windows Embedded CE 6.0)

1/6/2010

This method locks a range of vertex data and obtains a pointer to the vertex buffer memory.

Syntax

HRESULT Lock(
  UINT OffsetToLock,
  UINT SizeToLock,
  void** ppvData,
  DWORD Flags
);

Parameters

  • OffsetToLock
    [in] Offset into the vertex data to lock, in bytes.
  • SizeToLock
    [in] Size of the vertex data to lock, in bytes. Specify 0 to lock the entire vertex buffer.
  • ppvData
    [out] Address of a pointer to an array of BYTE values that is filled with the returned vertex data.
  • Flags
    [in] A combination of one or more D3DMLOCK Values to describe the type of lock to perform. The following list shows the allowable flags.

    • D3DMLOCK_READONLY
    • D3DMLOCK_DISCARD
    • D3DMLOCK_NOOVERWRITE

Return Value

If the method succeeds, the return value is D3DM_OK (see D3DM Values).

If the method fails, the return value can be D3DMERR_INVALIDCALL (see D3DMERR Values).

Remarks

When working with vertex buffers, you can make multiple lock calls; however, you must ensure that the number of lock calls match the number of unlock calls. If there is an outstanding lock count on any currently set vertex buffer, then IDirect3DMobileDevice::DrawPrimitive calls will not succeed.

The D3DMLOCK_DISCARD and D3DMLOCK_NOOVERWRITE flags (see D3DMLOCK Values) are valid only on buffers created with D3MDUSAGE_DYNAMIC (see D3DMUSAGE Values).

Requirements

Header d3dm.h
Library D3dm.lib, D3dmguid.lib
Windows Embedded CE Windows CE 5.0 and later

See Also

Reference

IDirect3DMobileVertexBuffer
D3DMLOCK Values
IDirect3DMobileDevice::DrawPrimitive
D3DMUSAGE Values