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

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.isSampler() của WebGL 2 API trả về true nếu đối tượng được truyền là một đối tượng WebGLSampler hợp lệ.

Cú pháp

js
isSampler(sampler)

Tham số

sampler

Một đối tượng WebGLSampler để kiểm tra.

Giá trị trả về

Một GLboolean cho biết đối tượng đã cho có phải là một đối tượng WebGLSampler hợp lệ (true) hay không (false).

Ví dụ

gl phải là một WebGL2RenderingContext. Đối tượng WebGLSampler không có sẵn trong WebGL 1.

js
const sampler = gl.createSampler();

// …

gl.isSampler(sampler);

Đặc tả kỹ thuật

Specification
WebGL 2.0 Specification
# 3.7.13

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

Xem thêm