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

Model

Quick answer

Model is the high-level drawable that combines shaders, vertex attributes, a buffer layout and render state into one object. Construct new Model(device, {vs, fs, attributes, bufferLayout, topology, parameters}), then call draw(renderPass) each frame. In v9 uniforms live in uniform buffers rather than setUniforms.

Last verified 2026-11-03 · luma.gl 9.4 · Cite this page
new Model ( device , props ) → Model
Key points
Example
const positions = device.createBuffer(new Float32Array([
  -0.6, -0.45, 0,
   0.6, -0.45, 0,
   0.0,  0.55, 0
]));

const colors = device.createBuffer(new Float32Array([
  0.95, 0.36, 0.32,
  0.98, 0.78, 0.35,
  0.35, 0.80, 0.95
]));

const model = new Model(device, {
  topology: 'triangle-list',
  vertexCount: 3,
  attributes: {
    positions: positions,
    colors: colors
  },
  bufferLayout: [
    { name: 'positions', stepMode: 'vertex', format: 'float32x3' },
    { name: 'colors', stepMode: 'vertex', format: 'float32x3' }
  ],
  vs: '#version 300 es\n...',
  fs: '#version 300 es\n...'
});
const pass = device.beginRenderPass({ clearColor: [0.04, 0.06, 0.09, 1] });

model.setVertexCount(count);
model.draw(pass);

pass.end();
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). Model. https://www.jingweizhi.com/en/lumagl/api/model.html (accessed 2026-11-03).