Atlaslog
Atlaslog / luma.gl / API reference / Buffer
luma.gl · API reference

Buffer

Quick answer

Buffer is a linear GPU memory block created by device.createBuffer, holding vertex, index, uniform or storage data. Set data or byteLength at creation, choose usage flags such as Buffer.VERTEX or Buffer.INDEX, and rewrite contents through write(). Index buffers also take an indexType so uint16 and uint32 bind correctly.

Last verified 2026-11-03 · luma.gl 9.4 · Cite this page
device. createBuffer ( props ) → Buffer
Key points
Example
const positions = device.createBuffer(new Float32Array([
  -0.5, -0.5, 0,
   0.5, -0.5, 0,
   0.0,  0.5, 0
]));
const vertexBuffer = device.createBuffer({
  data: new Float32Array(vertexData),
  usage: Buffer.VERTEX | Buffer.COPY_DST
});

const indexBuffer = device.createBuffer({
  data: new Uint32Array([0, 1, 2]),
  usage: Buffer.INDEX,
  indexType: 'uint32'
});

const uniformBuffer = device.createBuffer({
  byteLength: 64,
  usage: Buffer.UNIFORM | Buffer.COPY_DST
});
Notes
Runnable examplesChinese originalAll API references
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Cite this page

Atlaslog (2026). Buffer. https://www.jingweizhi.com/en/lumagl/api/buffer.html (accessed 2026-11-03).