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}).
Key points
- Replace new Program with two Shader objects plus a RenderPipeline.
- Model wraps pipeline, VertexArray and bindings for ordinary draws.
- Initial uniform values can still be passed to Model at construction.
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
- Importing Program from luma.gl v9 yields undefined rather than a warning.
- Porting v8 code without recreating pipelines per state change leaves stale state.
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Atlaslog (2026). Program. https://www.jingweizhi.com/en/lumagl/api/program.html (accessed 2026-11-03).