Partager via


Triangle Fans (Windows Embedded CE 6.0)

1/6/2010

A triangle fan is similar to a triangle strip, except that all the triangles share one vertex, as shown in the following illustration.

Ee491065.f8893102-c1c3-4e88-a4d9-de701522af69(en-US,WinEmbedded.60).gif

The system uses vertices v2, v3, and v1 to draw the first triangle, v3, v4, and v1 to draw the second triangle, v4, v5, and v1 to draw the third triangle, and so on. When flat shading is enabled, the system shades the triangle with the color from its first vertex.

The following illustration shows a rendered triangle fan.

Ee491065.97f89d76-22b8-47c2-89fb-6905d351b824(en-US,WinEmbedded.60).gif

The triangle fan primitive is identified by the D3DMPT_TRIANGLEFAN element of the D3DMPRIMITIVETYPE enumeration.

The following code example shows how to create vertices for this triangle fan.

struct CUSTOMVERTEX
{
    float x,y,z;
};

CUSTOMVERTEX Vertices[] = 
{
    { 0.0, 0.0, 0.0},
    {-5.0, 5.0, 0.0},
    {-3.0,  7.0, 0.0},
    { 0.0, 10.0, 0.0},
    { 3.0,  7.0, 0.0},
    { 5.0,  5.0, 0.0},
};

The following code example shows how to use IDirect3DMobileDevice::DrawPrimitive to render this triangle fan.

//
// It is assumed that d3dmDevice is a valid
// pointer to a IDirect3DMobileDevice interface.
//
d3dmDevice->DrawPrimitive( D3DMPT_TRIANGLEFAN, 0, 4 );

See Also

Concepts

Device-Supported Primitive Types