Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

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

Syntax

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

Parameters

OffsetToLock

[in] Offset into the index data to lock, in bytes.

SizeToLock

[in] Size of the index data to lock, in bytes.

ppvData

[out] Address of a pointer to an array of BYTEvalues, filled with the returned index data.

Flags

[in] A combination of one or more D3DMLOCK Valuesto 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 index buffers, you can make multiple lock calls. However, you must ensure that the number of lock calls match the number of unlock calls. IDirect3DMobileDevice::DrawPrimitivecalls will not succeed with any outstanding lock count on any currently set index buffer.

The D3DMLOCK_DISCARD and D3DMLOCK_NOOVERWRITE flags are valid only on buffers created with D3MDUSAGE_DYNAMIC.

Requirements

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

See Also