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

BufferLayout

Quick answer

BufferLayout is a TypeScript type alias, not a class, describing how buffer bytes map to shader attributes. Each entry names an attribute plus its format, byteStride and stepMode of vertex or instance. VertexArray consumes the layout, and its names must match the ShaderLayout used by the pipeline.

Last verified 2026-11-03 · luma.gl 9.4 · Cite this page
type BufferLayout = { name, format?, byteStride?, stepMode?, attributes? }
Key points
Example
const bufferLayout = [
  { name: 'positions', stepMode: 'vertex', format: 'float32x3' },
  { name: 'colors', stepMode: 'vertex', format: 'float32x3' }
];
/* 每条记录 32 字节:位置 12 + 法线 12 + 颜色 8 */
const bufferLayout = [
  {
    name: 'vertexData',
    stepMode: 'vertex',
    byteStride: 32,
    attributes: [
      { attribute: 'positions', format: 'float32x3', byteOffset: 0 },
      { attribute: 'normals',   format: 'float32x3', byteOffset: 12 },
      { attribute: 'colors',    format: 'float32x2', byteOffset: 24 }
    ]
  }
];
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). BufferLayout. https://www.jingweizhi.com/en/lumagl/api/buffer-layout.html (accessed 2026-11-03).