Share via


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

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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
)
new : 
        device:Device * 
        sizeOfBufferInBytes:int * 
        usage:Usage * 
        pool:Pool * 
        sixteenBitIndices:bool -> IndexBuffer

Parameters

  • sizeOfBufferInBytes
    Type: System.Int32
    The size of the index buffer in bytes.
  • usage
    Type: Microsoft.WindowsMobile.DirectX.Direct3D.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.
  • sixteenBitIndices
    Type: System.Boolean
    Set to true if the index buffer contains 16-bit indices. Set to false if the index buffer contains 32-bit indices.

Exceptions

Exception 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

Platforms

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

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

Version Information

.NET Compact Framework

Supported in: 3.5, 2.0

See Also

Reference

IndexBuffer Class

IndexBuffer Members

IndexBuffer Overload

Microsoft.WindowsMobile.DirectX.Direct3D Namespace