Device.DrawPrimitives(PrimitiveType,Int32,Int32) Method (Microsoft.DirectX.Direct3D)
How Do I...?
- Generate a Scene
Renders a sequence of non-indexed geometric primitives of the specified type from the current set of data input streams.
Visual Basic Public Sub DrawPrimitives( _
ByVal primitiveType As PrimitiveType, _
ByVal startVertex As Integer, _
ByVal primitiveCount As Integer _
C# public void DrawPrimitives(
JScript public function DrawPrimitives(
primitiveType : PrimitiveType,
startVertex : int,
primitiveCount : int
Member of the PrimitiveType enumerated type that describes the type of primitive to render.
Index of the first vertex to load. Beginning at param_Int32_startVertex, the correct number of vertices is read out of the vertex buffer.
Number of primitives to render. To determine the maximum number of primitives allowed, check Caps.MaxPrimitiveCount. The param_Int32_primitiveCount is the number of primitives as determined by the primitive type. If it is a line list, each primitive has two vertices. If it is a triangle list, each primitive has three vertices.
Device.DrawPrimitives should not be called with a single triangle at a time.
The method call is invalid. For example, a method's parameter might contain an invalid value.
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.
[C#] device.BeginScene(); device.SetStreamSource(0, vBuffer, 0); device.VertexFormat = CustomVertex.PositionNormal.Format; device.DrawPrimitives(PrimitiveType.TriangleList, 0, 1); device.EndScene();