VertexBuffer Constructor (GraphicsDevice, Int32, ResourceUsage, ResourceManagementMode)

Initializes a new instance of the VertexBuffer class, specifying the size in bytes and the resource management mode to use for this vertex buffer resource.

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

Syntax

public VertexBuffer (
         GraphicsDevice graphicsDevice,
         int sizeInBytes,
         ResourceUsage usage,
         ResourceManagementMode resourceManagementMode
)

Parameters

  • graphicsDevice
    The graphics device to associate with this vertex buffer.
  • sizeInBytes
    The number of bytes to allocate for this vertex buffer resource.
  • usage
    A set of options identifying the behaviors of this vertex buffer resource. It is good practice to match the usage parameter with the createOptions parameter in the GraphicsDevice constructor.
  • resourceManagementMode
    The resource management mode to use for this vertex buffer resource.

Exceptions

Exception type Condition
ArgumentNullException graphicsDevice is null.
ArgumentOutOfRangeException sizeInBytes is less than or equal to zero. sizeInBytes must be greater than zero.
InvalidOperationException Unable to create this VertexBuffer resource on the graphics device.

See Also

Reference

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

Platforms

Xbox 360, Windows XP SP2, Windows Vista