Share via


PrimitiveType Enumeration (Microsoft.DirectX.Direct3D)

How Do I...?

  • Generate a Scene

Defines the primitives supported by Microsoft Direct3D.

Definition

Visual Basic Public Enum PrimitiveType
C# public enum PrimitiveType
C++ public enum class PrimitiveType
JScript public enum PrimitiveType

Members

Member Value Description
TriangleFan 6 Renders the vertices as a triangle fan.
TriangleStrip 5 Renders the vertices as a triangle strip. The back face culling flag is flipped automatically on even-numbered triangles.
TriangleList 4 Renders the specified vertices as a sequence of isolated triangles. Each group of three vertices defines a separate triangle. Back face culling is affected by the current winding-order render state.
LineStrip 3 Renders the vertices as a single polyline. Calls that use this primitive type fail if the count is less than two.
LineList 2 Renders the vertices as a list of isolated straight line segments. Calls that use this primitive type fail if the count is less than two or is odd.
PointList 1 Renders the vertices as a collection of isolated points. This value is unsupported for indexed primitives.

Remarks

Using Triangle Strips or Triangle Fans is often more efficient than using Triangle Lists because fewer vertices are duplicated.

How Do I...?

Generate a Scene

This example shows how to begin scene generation and draw primitives.

The SetStreamSource method binds a vertex buffer to a device data stream to create an association between the vertex data and one of several data stream ports that feed the primitive processing functions. The parameters for this method are the number of the data stream, the name of the VertexBuffer object, and the stream vertex stride.

In the following C# code example, it is assumed that the device is the rendering Device, and vBuffer is a vertex buffer filled with CustomVertex.PositionNormal data.

              [C#]
              
device.BeginScene();

device.SetStreamSource(0, vBuffer, 0);
device.VertexFormat = CustomVertex.PositionNormal.Format;
device.DrawPrimitives(PrimitiveType.TriangleList, 0, 1);

device.EndScene();

Enumeration Information

Namespace Microsoft.DirectX.Direct3D
Assembly Microsoft.DirectX.Direct3D (microsoft.directx.direct3d.dll)
Strong Name Microsoft.DirectX.Direct3D,  Version=1.0.900.0,  Culture=neutral,  PublicKeyToken=d3231b57b74a1492

See Also