The DrawPrimitive Methods

Direct3D offers several methods to render primitives and indexed primitives in a single call or as individual vertices. All rendering methods in the IDirect3DDevice3 interface accept a combination of flexible vertex format flags that describe the vertex type your application uses; these flags also determine which parts of the geometry pipeline the system will apply. (This differs from the version of the methods in the IDirect3DDevice2, which accept only the concrete vertex formats identified by members of the D3DPRIMITIVETYPE enumeration.) For more information about these descriptors, see Vertex Formats.

The DrawPrimitive family of rendering methods can be subdivided according to the style of primitive (non-indexed or indexed) a given method is capable of rendering. The system offers methods for both primitive styles, specified as groups of vertices or one vertex at a time. The following paragraphs reflect this subdivision:

Non-indexed and Indexed Primitive Methods
IDirect3DDevice3::DrawPrimitive, IDirect3DDevice3::DrawPrimitiveStrided, and IDirect3DDevice3::DrawPrimitiveVB render groups of non-indexed vertices, strided vertices, and non-indexed vertices contained within vertex buffers.

The IDirect3DDevice3::DrawIndexedPrimitive, IDirect3DDevice3::DrawIndexedPrimitiveStrided, and IDirect3DDevice3::DrawIndexedPrimitiveVB methods render vertex groups by indexing into a provided array of vertices, strided vertices, or by indexing into vertices within a vertex buffer.

Non-indexed and Indexed Vertex Methods
The IDirect3DDevice3::Begin method informs the system that you are beginning a sequence of vertices, and you can render the vertices with subsequent calls to IDirect3DDevice3::Vertex. When you are done with a sequence of vertices, you must call the IDirect3DDevice3::End method.

Similar to the non-indexed vertex rendering methods, the system offers the IDirect3DDevice3::BeginIndexed method to begin rendering vertices by their index, followed by calls to IDirect3DDevice3::Index for each vertex. (Just like non-indexed vertices, you finish the vertex sequence by calling IDirect3DDevice3::End.)

When you render a primitive, the associated methods accept parameters that describe the type of primitive being rendered (such as a triangle strip, a triangle list, or another primitive type), the vertex format, rendering behavior flags, and vertex information. These flags and their effects are documented in the references for the rendering methods.

Note that the number of vertices you need to provide for the methods depends on the type of primitive you are rendering. For instance, if you're rendering a line list, you must provide at least two vertices to define a single line, and the total number must be an even value. Likewise for a triangle list, you must include at least three vertices, with the total evenly divisible by three. For information about vertex counts for other types of primitives, see Primitive Types and D3DPRIMITIVETYPE.

Vertex buffers, and the methods to render from them, provide performance and ease-of-use enhancements that improve upon rendering vertices from your own data structures. For more information, see Vertex Buffers.