Share via


IndexBuffer Constructor (Device, Int32, Usage, Pool, Boolean)

Initializes a new instance of the IndexBuffer class.

Namespace: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)

Syntax

'Declaration
Public Sub New ( _
    device As Device, _
    sizeOfBufferInBytes As Integer, _
    usage As Usage, _
    pool As Pool, _
    sixteenBitIndices As Boolean _
)
'Usage
Dim device As Device
Dim sizeOfBufferInBytes As Integer
Dim usage As Usage
Dim pool As Pool
Dim sixteenBitIndices As Boolean

Dim instance As New IndexBuffer(device, sizeOfBufferInBytes, usage, pool, sixteenBitIndices)
public IndexBuffer (
    Device device,
    int sizeOfBufferInBytes,
    Usage usage,
    Pool pool,
    bool sixteenBitIndices
)
public:
IndexBuffer (
    Device^ device, 
    int sizeOfBufferInBytes, 
    Usage usage, 
    Pool pool, 
    bool sixteenBitIndices
)
public IndexBuffer (
    Device device, 
    int sizeOfBufferInBytes, 
    Usage usage, 
    Pool pool, 
    boolean sixteenBitIndices
)
public function IndexBuffer (
    device : Device, 
    sizeOfBufferInBytes : int, 
    usage : Usage, 
    pool : Pool, 
    sixteenBitIndices : boolean
)

Parameters

  • device
    The Device object to associate with the index buffer.
  • sizeOfBufferInBytes
    The size of the index buffer in bytes.
  • usage
    The usage can be 0, which indicates no usage value. However, if usage is desired, use a combination of one or more Usage flags. It is good practice to match the usage parameter with the behavior flags in the Device constructor.
  • pool
    A member of the Pool enumerated type that describes a valid memory class into which to place the resource.
  • sixteenBitIndices
    Set to true if the index buffer contains 16-bit indices. Set to false if the index buffer contains 32-bit indices.

Exceptions

Exception type Condition

InvalidCallException

The method call is invalid. For example, a method's parameter might contain an invalid value.

OutOfMemoryException

Direct3D does not have enough display memory to perform the operation.

Remarks

Index buffers are memory resources used to hold indices. They are similar to surfaces and vertex buffers. The use of index buffers enables Direct3D to avoid unnecessary data copying and to place the buffer in the optimal memory type for the expected usage.

To use an index buffer:

  1. Create an index buffer.

  2. Lock the index buffer, fill it with indices, and then unlock it.

  3. Pass the index buffer it to the Indices property of a Device.

  4. Set up the vertices and vertex shader.

  5. Call the DrawIndexedPrimitives method on the Device to render.

The MaxVertexIndex of a Caps indicates the maximum value of an index that can be used in an index buffer.

.NET Framework Security

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Platforms

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Version Information

.NET Compact Framework

Supported in: 2.0

See Also

Reference

IndexBuffer Class
IndexBuffer Members
Microsoft.WindowsMobile.DirectX.Direct3D Namespace