An index buffer stores index values into a VertexBuffer. Indexed graphical primitives can normally utilize less memory that unindexed primitives (if vertices are shared).

Typically, index buffers are set on Mesh objects.


  • Create a new IndexBuffer instance.


    • graphicsDevice: GraphicsDevice

      The graphics device used to manage this index buffer.

    • format: number

      The type of each index to be stored in the index buffer. Can be:

    • numIndices: number

      The number of indices to be stored in the index buffer.

    • Optionalusage: number = BUFFER_STATIC

      The usage type of the vertex buffer. Can be:

      Defaults to BUFFER_STATIC.

    • OptionalinitialData: ArrayBuffer

      Initial data. If left unspecified, the index buffer will be initialized to zeros.

    • Optionaloptions: {
          storage: boolean;

      Object for passing optional arguments.

      • storage: boolean

        Defines if the index buffer can be used as a storage buffer by a compute shader. Defaults to false. Only supported on WebGPU.

    Returns IndexBuffer

    // Create an index buffer holding 3 16-bit indices. The buffer is marked as
    // static, hinting that the buffer will never be modified.
    const indices = new UInt16Array([0, 1, 2]);
    const indexBuffer = new pc.IndexBuffer(graphicsDevice,


  • Signals that the block of memory returned by a call to the lock function is ready to be given to the graphics hardware. Only unlocked index buffers can be set on the currently active device.

    Returns void