Share via


GraphicsDevice.DrawInstancedPrimitives Method

Draws a series of instanced models.

Syntax

'Declaration
Public Sub DrawInstancedPrimitives ( _
         primitiveType As PrimitiveType, _
         baseVertex As Integer, _
         minVertexIndex As Integer, _
         numVertices As Integer, _
         startIndex As Integer, _
         primitiveCount As Integer, _
         instanceCount As Integer _
)
public void DrawInstancedPrimitives (
         PrimitiveType primitiveType,
         int baseVertex,
         int minVertexIndex,
         int numVertices,
         int startIndex,
         int primitiveCount,
         int instanceCount
)
public:
void DrawInstancedPrimitives(
         PrimitiveType primitiveType,
         int baseVertex,
         int minVertexIndex,
         int numVertices,
         int startIndex,
         int primitiveCount,
         int instanceCount
)

Parameters

  • primitiveType
    Type: PrimitiveType
    The primitive type.
  • baseVertex
    Type: Int32
    Offset to add to each vertex index in the index buffer.
  • minVertexIndex
    Type: Int32
    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
    Type: Int32
    Number of vertices used during the call. The first vertex is located at index: baseVertex + minVertexIndex.
  • startIndex
    Type: Int32
    Location in the index array at which to start reading vertices.
  • primitiveCount
    Type: Int32
    Number of primitives to render. The number of vertices used is a function of primitiveCount and primitiveType.
  • instanceCount
    Type: Int32
    Number of primitives to render.

Exceptions

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

Remarks

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. https://blogs.msdn.com/b/shawnhar/archive/2010/06/17/drawinstancedprimitives-in-xna-game-studio-4-0.aspx. June 2010.

Requirements

Namespace: Microsoft.Xna.Framework.Graphics

Assembly: Microsoft.Xna.Framework.Graphics (in microsoft.xna.framework.graphics.dll)

See Also

Reference

GraphicsDevice Class
GraphicsDevice Members
Microsoft.Xna.Framework.Graphics Namespace

Platforms

Windows Phone