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
samplerParameteri(sampler, pname, param)
samplerParameterf(sampler, pname, param)
Tham số
sampler-
Một đối tượng
WebGLSampler. pname-
Một
GLenumchỉ định tham số nào sẽ đặt. Các giá trị có thể:gl.TEXTURE_COMPARE_FUNC-
Một
GLenumchỉ định hàm so sánh texture. gl.TEXTURE_COMPARE_MODE-
Một
GLenumchỉ định chế độ so sánh texture. gl.TEXTURE_MAG_FILTER-
Một
GLenumchỉ định bộ lọc phóng đại texture. gl.TEXTURE_MAX_LOD-
Một
GLfloatchỉ định giá trị mức chi tiết tối đa. gl.TEXTURE_MIN_FILTER-
Một
GLenumchỉ định bộ lọc thu nhỏ texture. gl.TEXTURE_MIN_LOD-
Một
GLfloatchỉ định giá trị mức chi tiết tối thiểu. gl.TEXTURE_WRAP_R-
Một
GLenumchỉ định hàm bao quanh texture cho tọa độ texture r. gl.TEXTURE_WRAP_S-
Một
GLenumchỉ định hàm bao quanh texture cho tọa độ texture s. gl.TEXTURE_WRAP_T-
Một
GLenumchỉ định hàm bao quanh texture cho tọa độ texture t.
param-
Một
GLint(samplerParameteri) hoặc mộtGLfloat(samplerParameterf) chỉ định giá trị chopname.
Giá trị trả về
None (undefined).
Ví dụ
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> |