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

Program

Quick answer

Program no longer exists in luma.gl v9. Shader compilation moved to Shader, linking plus fixed render state moved to RenderPipeline, and everyday drawing is wrapped by Model. This page explains the split and how to migrate v8 code that called new Program(gl, {vs, fs}).

Last verified 2026-11-03 · luma.gl 9.4 · Cite this page
Key points
Example
const vs = device.createShader({
  stage: 'vertex',
  source: [
    '#version 300 es',
    'in vec3 positions;',
    'void main() {',
    '  gl_Position = vec4(positions, 1.0);',
    '}'
  ].join('\n')
});

const fs = device.createShader({
  stage: 'fragment',
  source: [
    '#version 300 es',
    'precision highp float;',
    'out vec4 fragColor;',
    'void main() {',
    '  fragColor = vec4(0.35, 0.80, 0.62, 1.0);',
    '}'
  ].join('\n')
});

const pipeline = device.createRenderPipeline({
  vs: vs,
  fs: fs,
  topology: 'triangle-list',
  bufferLayout: [
    { name: 'positions', stepMode: 'vertex', format: 'float32x3' }
  ],
  parameters: {
    depthWriteEnabled: true,
    depthCompare: 'less-equal'
  }
});
const model = new Model(device, {
  vs: vsSource,
  fs: fsSource,
  attributes: { positions: positions },
  bufferLayout: [
    { name: 'positions', stepMode: 'vertex', format: 'float32x3' }
  ],
  vertexCount: 3,
  topology: 'triangle-list'
});

const pass = device.beginRenderPass({ clearColor: [0.05, 0.07, 0.1, 1] });
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). Program. https://www.jingweizhi.com/en/lumagl/api/program.html (accessed 2026-11-03).