Renders geometric primitives with indexed data specified by the user, specifying an index buffer as an array of type
Int32.
Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
public void DrawUserIndexedPrimitives<T> (
PrimitiveType primitiveType,
T[] vertexData,
int vertexOffset,
int numVertices,
int[] indexData,
int indexOffset,
int primitiveCount
) where T : ValueType
Type Parameters
- T
- The type of vertex in vertexData.
Parameters
- primitiveType
- Describes the type of primitive to render.
- vertexData
- The vertex buffer indexed by indexData.
- vertexOffset
- Offset to add to each vertex index in the index buffer.
- numVertices
- Number of vertices used during this call. The first vertex is located at index minVertexIndex.
- indexData
- A list of indices into the vertex buffer, given in the order that you want the vertices to render. Using an array of type Int32, which uses 32 bits per element, allows you to index a greater number of elements in the vertex buffer.
- indexOffset
- Location in the index array at which to start reading vertices.
- primitiveCount
-
Number of primitives to render. The maximum number of primitives allowed is determined by checking MaxPrimitiveCount. (The number of indices is a function of the primitive count and the primitive type.)
| Exception type | Condition |
|---|
| ArgumentException |
One of the following conditions is true:
-
vertexOffset + numVertices is outside of the range of vertexData.
-
There are not enough indices in indexData based on the number of primitives requested by primitiveCount.
|
| ArgumentNullException |
vertexData or indexData is null.
|
| ArgumentOutOfRangeException |
One of the following conditions is true:
-
indexOffset or vertexOffset is not in a range allowed by indexData or vertexData.
-
primitiveCount or numVertices is less than or equal to zero. When drawing, at least one primitive must be drawn.
|
| InvalidOperationException |
One of the following conditions is true:
-
VertexDeclaration is not a valid value. A valid vertex declaration must be set on the device before any draw operations can be performed.
-
A valid vertex shader and pixel shader was not set before calling DrawUserIndexedPrimitives. Both a valid vertex shader and pixel shader (or valid effect) must be set on the device before any draw operations may be performed. See How To: Use BasicEffect or How To: Create and Apply Custom Effects for more information on applying effects.
-
vertexData is not a valid vertex buffer, or indexData is not a valid index buffer. A valid vertex buffer (and a valid index buffer if you are using indexed primitives) must be set on the device before any draw operations may be performed.
- The active render target and depth stencil surface do not have the same pixel size and multisampling type.
|
Reference
Xbox 360, Windows XP SP2, Windows Vista