DirectX SDK

IDirect3DDevice7::DrawIndexedPrimitiveVB

The IDirect3DDevice7::DrawIndexedPrimitiveVB method renders a geometric primitive based on indexing into an array of vertices within a vertex buffer.

HRESULT DrawIndexedPrimitiveVB(
  D3DPRIMITIVETYPE        d3dptPrimitiveType,
  LPDIRECT3DVERTEXBUFFER7 lpd3dVertexBuffer,
  DWORD  dwStartVertex,
  DWORD  dwNumVertices,
  LPWORD lpwIndices,
  DWORD  dwIndexCount,
  DWORD  dwFlags
);

Parameters

d3dptPrimitiveType
Type of primitive to be rendered by this command. This must be one of the members of the D3DPRIMITIVETYPE enumerated type.

The D3DPT_POINTLIST member of D3DPRIMITIVETYPE is not indexed.

lpd3dVertexBuffer
Address of the IDirect3DVertexBuffer7 interface for the vertex buffer that contains the array of vertices. Vertices can be transformed or untransformed, optimized or unoptimized.
dwStartVertex
Index of the first vertex in the vertex buffer to be rendered.
dwNumVertices
Total number of vertices in the vertex buffer to be rendered.
lpwIndices
Address of an array of WORDs that is used to index into the vertices in the vertex buffer. The values in the array must index vertices within the range [0, dwNumVertices – 1].
dwIndexCount
The number of indices in the array at lpwIndices. The maximum number of indices allowed is D3DMAXNUMVERTICES (0xFFFF).
dwFlags
Zero to render the primitive without waiting, or the following flag:
D3DDP_WAIT
Causes the method to wait until the polygons have been rendered before it returns, instead of returning as soon as the polygons have been sent to the card. (On scene-capture cards, the method returns as soon as the card responds.) This flag is typically used for debugging. Applications should not attempt to use this flag to ensure that a scene is up to date before continuing.

Return Values

If the method succeeds, the return value is DD_OK.

If the method fails, the return value can be one of the following values:

D3DERR_INVALIDPRIMITIVETYPE
D3DERR_INVALIDVERTEXTYPE
D3DERR_VERTEXBUFFERLOCKED
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_WASSTILLDRAWING

Remarks

Be sure that the vertices being rendered match the vertex format that you specify. For performance reasons, Direct3D does not attempt to verify that vertex size and stride match the provided flexible vertex format. If a mismatch occurs, a memory fault is likely to result.

This method, unlike its predecessor in previous interfaces, does not accept the D3DDP_DONOTCLIP, D3DDP_DONOTLIGHT, and D3DDP_DONOTUPDATEEXTENTS flags in the dwFlags parameter. The functionality offered by these flags is now available through the D3DRENDERSTATE_CLIPPING, D3DRENDERSTATE_LIGHTING, and D3DRENDERSTATE_EXTENTS render states.

Software devices—MMX and RGB devices—cannot render from a video memory (local or nonlocal) vertex buffer. To render a vertex buffer, using a software device, the vertex buffer must exist in system memory. Hardware devices can render from system memory or video memory vertex buffers.

You cannot render from a locked vertex buffer; calls to the IDirect3DDevice7::DrawIndexedPrimitiveVB or IDirect3DDevice7::DrawPrimitiveVB method, using a locked buffer fail, returning D3DERR_VERTEXBUFFERLOCKED.

In the IDirect3DDevice3 interface, this method accepted a pointer to the legacy IDirect3DVertexBuffer interface.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Version: Requires DirectX 7.0.
  Header: Declared in d3d.h.

See Also

IDirect3DDevice7::DrawPrimitive, IDirect3DDevice7::DrawPrimitiveStrided, IDirect3DDevice7::DrawPrimitiveVB, IDirect3DDevice7::DrawIndexedPrimitive, IDirect3DDevice7::DrawIndexedPrimitiveStrided