Firefox Tomorrow

web api instance method

WebGLRenderingContext: linkProgram() method

View on MDN ↗

Available in workers

The WebGLRenderingContext interface’s linkProgram() method links a given WebGLProgram, completing the process of preparing the GPU code for the program’s fragment and vertex shaders.

Syntax

linkProgram(program)

Parameters

Return value

None (undefined).

Examples

const program = gl.createProgram();

// Attach pre-existing shaders
gl.attachShader(program, vertexShader);
gl.attachShader(program, fragmentShader);

gl.linkProgram(program);

if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
  const info = gl.getProgramInfoLog(program);
  throw new Error(`Could not compile WebGL program. \n\n${info}`);
}

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also