WebGL2RenderingContext: phương thức samplerParameter[if]()

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.

Các phương thức WebGL2RenderingContext.samplerParameter[if]() của WebGL 2 API đặt các tham số WebGLSampler.

Cú pháp

js
samplerParameteri(sampler, pname, param)
samplerParameterf(sampler, pname, param)

Tham số

sampler

Một đối tượng WebGLSampler.

pname

Một GLenum chỉ định tham số nào sẽ đặt. Các giá trị có thể:

gl.TEXTURE_COMPARE_FUNC

Một GLenum chỉ định hàm so sánh texture.

gl.TEXTURE_COMPARE_MODE

Một GLenum chỉ định chế độ so sánh texture.

gl.TEXTURE_MAG_FILTER

Một GLenum chỉ định bộ lọc phóng đại texture.

gl.TEXTURE_MAX_LOD

Một GLfloat chỉ định giá trị mức chi tiết tối đa.

gl.TEXTURE_MIN_FILTER

Một GLenum chỉ định bộ lọc thu nhỏ texture.

gl.TEXTURE_MIN_LOD

Một GLfloat chỉ định giá trị mức chi tiết tối thiểu.

gl.TEXTURE_WRAP_R

Một GLenum chỉ định hàm bao quanh texture cho tọa độ texture r.

gl.TEXTURE_WRAP_S

Một GLenum chỉ định hàm bao quanh texture cho tọa độ texture s.

gl.TEXTURE_WRAP_T

Một GLenum chỉ định hàm bao quanh texture cho tọa độ texture t.

param

Một GLint (samplerParameteri) hoặc một GLfloat (samplerParameterf) chỉ định giá trị cho pname.

Giá trị trả về

None (undefined).

Ví dụ

js
const sampler = gl.createSampler();
gl.samplerParameteri(sampler, gl.TEXTURE_MAG_FILTER, gl.NEAREST);

Đặc tả kỹ thuật

Specification
WebGL 2.0 Specification
# 3.7.13

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

Xem thêm