IDirect3DDevice2::DrawIndexedPrimitive

The IDirect3DDevice2::DrawIndexedPrimitive method renders the specified geometric primitive based on indexing into an array of vertices.

HRESULT DrawIndexedPrimitive(
  D3DPRIMITIVETYPE d3dptPrimitiveType,  
  D3DVERTEXTYPE d3dvtVertexType,        
  LPVOID lpvVertices,                   
  DWORD dwVertexCount,                  
  LPWORD dwIndices,                     
  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.

Note that the D3DPT_POINTLIST member of D3DPRIMITIVETYPE is not indexed.

d3dvtVertexType
Indicates the types of the vertices used. This must be one of the members of the D3DVERTEXTYPE enumerated type.
lpvVertices
Pointer to the list of vertices to be used in the primitive sequence.
dwVertexCount
Defines the number of vertices in the list.

Notice that this parameter is used differently from the dwVertexCount parameter in the IDirect3DDevice2::DrawPrimitive method. In that method, the dwVertexCount parameter gives the number of vertices to draw, but here it gives the total number of vertices in the array pointed to by the lpvVertices parameter. When you call IDirect3DDevice2::DrawIndexedPrimitive, you specify the number of vertices to draw in the dwIndexCount parameter.

dwIndices
Pointer to a list of WORDs that are to be used to index into the specified vertex list when creating the geometry to render.
dwIndexCount
Specifies the number of indices provided for creating the geometry.
dwFlags
One or more of the following flags defining how the primitive is drawn:
D3DDP_DONOTCLIP The application has already done the required clipping, so the system should not necessarily clip the primitives. (This flag is a hint; the system may clip the primitive even when this flag is specified, under some circumstances.)
D3DDP_DONOTUPDATEEXTENTS Disables the updating of the screen rectangle affected by this rendering call. Using this flag can potentially help performance, but the extents returned by IDirect3DDevice2::GetClipStatus will not have been updated to account for the data rendered by this call.
D3DDP_OUTOFORDER A hint to the system that the primitives can be rendered out of order. Note that back-to-back calls to DrawPrimitive methods using this flag may cause triangles from the primitives to be interleaved. The DrawPrimitive methods that use this flag are Begin, BeginIndexed, DrawIndexedPrimitive, and DrawPrimitive.
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 may be one of the following values:

D3DERR_INVALIDRAMPTEXTURE Ramp mode is being used and the texture handle in the current material does not match the current texture handle that is set as a render state.
DDERR_INVALIDPARAMS One of the arguments is invalid.

Remarks

In current versions of DirectX, IDirect3DDevice2::DrawIndexedPrimitive can sometimes generate an update rectangle that is larger than it strictly needs to be. If a large number of vertices need to be processed, this can have a negative impact on the performance of your application. If you are using D3DTLVERTEX vertices and the system is processing more vertices than you need, you should use the D3DDP_DONOTCLIP and D3DDP_DONOTUPDATEEXTENTS flags to solve the problem.

This method was introduced with the IDirect3DDevice2 interface.

QuickInfo

  Windows NT: Use version 5.0 or later.
  Windows: Use Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Header: Declared in d3d.h.
  Import Library: Use ddraw.lib.

See Also

IDirect3DDevice2::DrawPrimitive