WebGL2RenderingContext: phương thức getFragDataLocation()

Baseline Widely available

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

Note: This feature is available in Web Workers.

Phương thức WebGL2RenderingContext.getFragDataLocation() của WebGL 2 API trả về liên kết của số màu với các biến varying out do người dùng định nghĩa.

Cú pháp

js
getFragDataLocation(program, name)

Tham số

program

Một WebGLProgram để truy vấn.

name

Một chuỗi chỉ định tên của biến varying out do người dùng định nghĩa.

Giá trị trả về

Một GLint cho biết liên kết số màu được gán, hoặc -1 nếu không.

Ví dụ

js
// program là một WebGLProgram đã được liên kết

gl.getFragDataLocation(program, "fragColor");

Đặc tả kỹ thuật

Specification
WebGL 2.0 Specification
# 3.7.7

Tương thích trình duyệt

Xem thêm