---
name: "al_create_index_buffer"
section: "3alleg5"
platform: "linux"
package: "allegro5-doc"
version: "2:5.2.10.1+dfsg-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/al_create_index_buffer/3alleg5"
---

# al\_create\_index\_buffer(3alleg5)

Allegro 5 API

## NAME

al\_create\_index\_buffer - Allegro 5 API

## SYNOPSIS

-

  ```
  #include <allegro5/allegro_primitives.h>
  ALLEGRO_INDEX_BUFFER* al_create_index_buffer(int index_size,
      const void* initial_data, int num_indices, int flags)
  ```

## DESCRIPTION

Creates a index buffer. Can return NULL if the buffer could not be created (e.g. the system only supports write-only buffers).

*Note:*

This is an advanced feature, often unsupported on lower-end video cards. Be extra mindful of this function failing and make arrangements for fallback drawing functionality or a nice error message for users with such lower-end cards.

*Parameters:*

- •

  index\_size - Size of the index in bytes. Supported sizes are 2 for short integers and 4 for integers

- •

  initial\_data - Memory buffer to copy from to initialize the index buffer. Can be `NULL`, in which case the buffer is uninitialized.

- •

  num\_indices - Number of indices the buffer will hold

- •

  flags - A combination of the ALLEGRO\_PRIM\_BUFFER\_FLAGS(3alleg5) flags specifying how this buffer will be created. Passing 0 is the same as passing `ALLEGRO_PRIM_BUFFER_STATIC`.

## SINCE

5\.1.8

## SEE ALSO

ALLEGRO\_INDEX\_BUFFER(3alleg5), al\_destroy\_index\_buffer(3alleg5)
