GraphicsDevice.DrawInstancedPrimitives Method

XNA Game Studio 4.0
Draws a series of instanced models.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework.Graphics (in

public void DrawInstancedPrimitives (
         PrimitiveType primitiveType,
         int baseVertex,
         int minVertexIndex,
         int numVertices,
         int startIndex,
         int primitiveCount,
         int instanceCount


The primitive type.
Offset to add to each vertex index in the index buffer.
Minimum vertex index for vertices used during the call. The minVertexIndex parameter and all of the indices in the index stream are relative to the baseVertex parameter.
Number of vertices used during the call. The first vertex is located at index: baseVertex + minVertexIndex.
Location in the index array at which to start reading vertices.
Number of primitives to render. The number of vertices used is a function of primitiveCount and primitiveType.
Number of primitives to render.

Exception typeCondition
NotImplementedException This method is not implemented for Windows Phone, which does not support instancing.

This method provides a mechanism for gathering vertex shader input data from different streams at different frequencies (typically by interpreting one data stream as a per-instance world transform); this approach requires a custom shader to interpret the input data. For more information, see DrawInstancedPrimitives in XNA Game Studio 4.0.

Cited Works

"DrawInstancedPrimitives in XNA Game Studio 4.0." Shawn Hargreaves Blog. June 2010.

Xbox 360, Windows 7, Windows Vista, Windows XP, Windows Phone 7

Community Additions