Class: Buffer


A wrapper for data so that it can be used and uploaded by WebGL

new PIXI.Buffer (data, _static, index)

Name Type Attributes Default Description
data ArrayBuffer | SharedArrayBuffer | ArrayBufferView <optional>

the data to store in the buffer.

_static boolean <optional>

true for static buffer

index boolean <optional>

true for index buffer


data ArrayBuffer | SharedArrayBuffer | ArrayBufferView

The data in the buffer, as a typed array


Flags whether this is an index buffer.

Index buffers are of type ELEMENT_ARRAY_BUFFER. Note that setting this property to false will make the buffer of type ARRAY_BUFFER.

For backwards compatibility.


The type of buffer this is, one of:

  • ELEMENT_ARRAY_BUFFER - used as an index buffer
  • ARRAY_BUFFER - used as an attribute buffer
  • UNIFORM_BUFFER - used as a uniform buffer (if available)


PIXI.Buffer.from (data) PIXI.Buffer static

Helper function that creates a buffer based on an array or TypedArray

Name Type Description
data ArrayBufferView | number<Array>

the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.

Type Description
PIXI.Buffer A new Buffer based on the data provided.

destroy () void

Destroys the buffer

dispose () void

disposes WebGL resources that are connected to this geometry

update (data) void

flags this buffer as requiring an upload to the GPU

Name Type Attributes Description
data ArrayBuffer | SharedArrayBuffer | ArrayBufferView | Array<number> <optional>

the data to update in the buffer.