GraphicsDevice.DrawUserPrimitives Generic Method
Renders the given geometric primitive with data specified by the user.
Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
Syntax
public void DrawUserPrimitives<T> (
PrimitiveType primitiveType,
T[] vertexData,
int vertexOffset,
int primitiveCount
) where T : ValueType
Type Parameters
- T
Parameters
- primitiveType
Describes the type of primitive to render. - vertexData
The vertex data. - vertexOffset
Offset at which to begin reading vertexData. - 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 primitiveCount and primitiveType.
Exceptions
Exception type | Condition |
---|---|
ArgumentException | vertexOffset + numVertices is outside of the range of vertexData. |
ArgumentNullException | vertexData is null. |
ArgumentOutOfRangeException | One of the following conditions is true:
|
InvalidOperationException | One of the following conditions is true:
|
Remarks
This method is intended for use when drawing dynamic geometry specified by the user. It supports only a single vertex stream. The effect of this call is to use the provided vertex data pointer and stride for vertex stream 0. It is invalid to have the declaration of the current vertex shader refer to vertex streams other than stream 0.
The vertex data passed to DrawUserPrimitives does not need to persist after the call. Access to the data is completed before returning from the call.
See Also
Tasks
Reference
GraphicsDevice Class
GraphicsDevice Members
Microsoft.Xna.Framework.Graphics Namespace
Platforms
Xbox 360, Windows XP SP2, Windows Vista