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 microsoft.xna.framework.graphics.dll)

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

Parameters

primitiveType
The primitive type.
baseVertex
Offset to add to each vertex index in the index buffer.
minVertexIndex
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.
numVertices
Number of vertices used during the call. The first vertex is located at index: baseVertex + minVertexIndex.
startIndex
Location in the index array at which to start reading vertices.
primitiveCount
Number of primitives to render. The number of vertices used is a function of primitiveCount and primitiveType.
instanceCount
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. http://blogs.msdn.com/b/shawnhar/archive/2010/06/17/drawinstancedprimitives-in-xna-game-studio-4-0.aspx. June 2010.

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

Community Additions

ADD
Show: