IDirect3DMobileDevice::CreateVertexBuffer (Windows CE 5.0)

Windows CE 5.0
Send Feedback

This method creates a vertex buffer.

HRESULT CreateVertexBuffer(
  UINT Length,
  DWORD Usage,
  DWORD FVF,
  D3DMPOOL Pool,
  IDirect3DMobileVertexBuffer** ppVertexBuffer
);

Parameters

Length
[in] Size of the vertex buffer, in bytes. For flexible vertex format (FVF) vertex buffers, Length must be large enough to contain at least one vertex, and must be a multiple of the vertex size.
Usage
[in] Combination of one or more of the following flags, from the D3DMUSAGE Values, describing the usage controls for this resource.
FlagDescription
D3DUSAGE_DONOTCLIPSet to indicate that the vertex buffer content will never require clipping. When rendering with buffers that have this flag set, the D3DMRS_CLIPPING render state (see D3DMRENDERSTATETYPE) must be set to FALSE.
D3DUSAGE_DYNAMICSet to indicate when the vertex or index buffer requires dynamic memory usage. This usage is useful for drivers because it enables them to decide where to place the driver. In general, static vertex buffers will be placed in video memory and dynamic vertex buffers will be placed in AGP memory.

Note that there is no separate static usage; if you do not specify D3DMUSAGE_DYNAMIC, the vertex buffer is made static. D3DMUSAGE_DYNAMIC is strictly enforced through the D3DMLOCK_DISCARD and D3DMLOCK_NOOVERWRITE locking flags. (see D3DMLOCK Values).

As a result, D3DMLOCK_DISCARD and D3DMLOCK_NOOVERWRITE are only valid on vertex and index buffers created with D3DMUSAGE_DYNAMIC; they are not valid flags on static vertex buffers.

D3DUSAGE_WRITEONLYInforms the system that the application writes only to the vertex buffer. Using this flag enables the driver to choose the best memory location for efficient write operations and rendering. Attempts to read from a vertex buffer that is created with this capability will fail.
FVF
[in] Combination of flexible vertex format (FVF) flags, a usage specifier that describes the vertex format of the vertices in this buffer. For more information, see Vertex Data Description. When this parameter is set to a valid FVF code, the created vertex buffer is an FVF vertex buffer (see Remarks); otherwise the call fails.
Pool
[in] Member of the D3DMPOOL enumerated type that describes a valid memory class into which to place the resource.
ppVertexBuffer
[out] Address of a pointer to an IDirect3DMobileVertexBuffer interface that represents the created vertex buffer resource.

Return Values

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

If the method fails, the return value can be E_OUTOFMEMORY, or one of the following D3DMERR Values.

  • D3DMERR_MEMORYPOOLEMPTY
  • D3DMERR_INVALIDCAL

Remarks

The IDirect3DMobileDevice interface supports rendering of primitives using vertex data stored in vertex buffer objects. Vertex buffers are created from the IDirect3DMobileDevice interface, and are usable only with the IDirect3DMobileDevice object from which they are created.

When set to a non-zero value, which must be a valid FVF code, the FVF parameter indicates that the buffer content is to be characterized by an FVF code. A vertex buffer that is created with an FVF code is referred to as an FVF vertex buffer. For more information, see Vertex Data Description.

Requirements

OS Versions: Windows CE 5.0 and later.
Header: D3dm.h.
Link Library: D3dm.lib, D3dmguid.lib.

See Also

IDirect3DMobileDevice | D3DMUSAGE Values | D3DMRENDERSTATETYPE | D3DMLOCK Values | Vertex Data Description | D3DMPOOL | IDirect3DMobileVertexBuffer | IDirect3DMobileDevice | Vertex Data Description


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.


Show: