Expand Minimize

D3DHAL_DP2INDEXEDTRIANGLESTRIP structure

One or more D3DHAL_DP2INDEXEDTRIANGLESTRIP structures are parsed from the command buffer by the D3dDrawPrimitives2 callback when the D3DHAL_DP2COMMAND structure's bCommand member is set to D3DDP2OP_INDEXEDTRIANGLESTRIP, and are used to render strips of connected triangles using vertex indices.

Syntax


typedef struct _D3DHAL_DP2INDEXEDTRIANGLESTRIP {
  WORD wV[3];
} D3DHAL_DP2INDEXEDTRIANGLESTRIP, *LPD3DHAL_DP2INDEXEDTRIANGLESTRIP;

Members

wV

Specifies the index into the vertex buffer containing coordinate data for the first vertex of the triangle strip.

Although this member has only enough space to contain three indexes, this array of indexes should be treated as a variable-sized array with (wPrimitiveCount + 2) elements. (wPrimitiveCount is a member of the D3DHAL_DP2COMMAND structure.)

Remarks

D3dDrawPrimitives2 should process (wPrimitiveCount+2) indexes from the command buffer, in effect, processing wPrimitiveCount D3DHAL_DP2INDEXEDTRIANGLESTRIP structures.

The triangle edges in a triangle strip are rendered in this order: (wV[0], wV[1], wV[2]), (wV[1], wV[3], wV[2]), (wV[2], wV[3], wV[4]), (wV[3], wV[5], wV[4]),...

For the last triangle in the triangle strip, however, the edges are rendered in different orders when wPrimitiveCountt is odd and when it is even.

  • When wPrimitiveCount is an odd number, the last triangle's edges are rendered in this order: (wV[wPrimitiveCount - 1], wV[wPrimitiveCount], wV[wPrimitiveCount+ 1]).

  • When wPrimitiveCount is an even number, the last triangle's edges are rendered in this order: (wV[wPrimitiveCount- 1], wV[wPrimitiveCount+1], wV[wPrimitiveCount).

A D3DHAL_DP2STARTVERTEX structure immediately follows the command in the command buffer. The vertex buffer indexes are relative to the vertex buffer offset specified by the dwVertexOffset member of the D3DHAL_DRAWPRIMITIVES2DATA structure plus the base offset obtained from the wVStart member of the D3DHAL_DP2STARTVERTEX structure.

The following figure shows a portion of a sample command buffer containing a D3DDP2OP_INDEXEDTRIANGLESTRIP command, a D3DHAL_DP2STARTVERTEX offset of zero, and a logical list of D3DHAL_DP2INDEXEDTRIANGLESTRIP structures. The driver should process five vertices from the vertex buffer, rendering a strip of three triangles defined by (v[1], v[3], v[6]), (v[3], v[4], v[6]), (v[6], v[4], v[5]).

Figure showing a buffer with a D3DDP2OP_INDEXEDTRIANGLESTRIP command, a D3DHAL_DP2STARTVERTEX offset of zero, and a logical list of D3DHAL_DP2INDEXEDTRIANGLESTRIP structures

Requirements

Header

D3dhal.h (include D3dhal.h)

See also

D3DDP2OP_INDEXEDTRIANGLESTRIP
D3dDrawPrimitives2
D3DHAL_DP2COMMAND
D3DHAL_DP2STARTVERTEX
D3DHAL_DRAWPRIMITIVES2DATA

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft