Buffer

A Buffer is a block of GPU memory. Buffers are similar to Lua tables or arrays: they have a length and store a list of values. The length of a Buffer and its format (the type of each value) are declared upfront and can't be changed. Each value of a Buffer consists of one or more fields, and each field has a type. For example, if a Buffer is used to store vertices, each value might store 3 fields for the position, normal vector, and UV coordinates of a vertex.

Buffers are commonly used for:

There are two types of Buffers:

Constructors

lovr.graphics.getBufferGet a temporary Buffer.
lovr.graphics.newBufferCreate a new Buffer.

Methods

Buffer:clearClear the data in the Buffer.
Buffer:getFormatGet the format of the Buffer.
Buffer:getLengthGet the length of the Buffer.
Buffer:getPointerGet a raw pointer to the Buffer's memory.
Buffer:getSizeGet the size of the Buffer, in bytes.
Buffer:getStrideGet the distance between each item in the Buffer, in bytes.
Buffer:isTemporaryCheck if the Buffer is temporary.
Buffer:setDataChange the data in the Buffer.

See also