WebGLRenderingContext: getAttachedShaders() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Note: This feature is available in Web Workers.

Phương thức WebGLRenderingContext.getAttachedShaders() của WebGL API trả về một danh sách các đối tượng WebGLShader gắn với một WebGLProgram.

Cú pháp

js
getAttachedShaders(program)

Thông số

program

Một đối tượng WebGLProgram để nhận các shader đính kèm.

Giá trị trả về

Một Array của các đối tượng WebGLShader được gắn vào WebGLProgram đã cho.

Ví dụ

js
const program = gl.createProgram();

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

gl.getAttachedShaders(program);

Thông số kỹ thuật

Specification
WebGL Specification
# 5.14.9

Khả năng tương thích của trình duyệt

Xem thêm