Microsoft DirectX 8.1 (Visual Basic)

Triangle Fans

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

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 a triangle with the color from its second vertex.

This illustration depicts a rendered triangle fan.

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

Private Type CUSTOMVERTEX
    x As Single
    y As Single
    z As Single
End Type

Dim Vertices(5) As CUSTOMVERTEX
With Vertices(0): .x =  0.0: .y =  0.0: .z = 0.0: End With
With Vertices(1): .x = -5.0: .y =  5.0: .z = 0.0: End With
With Vertices(2): .x = -3.0: .y =  7.0: .z = 0.0: End With
With Vertices(3): .x =  0.0: .y = 10.0: .z = 0.0: End With
With Vertices(4): .x =  3.0: .y =  7.0: .z = 0.0: End With
With Vertices(5): .x =  5.0: .y =  5.0: .z = 0.0: End With