OES_texture_float_linear extension

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.

Phần mở rộng OES_texture_float_linear là một phần của WebGL API và cho phép lọc tuyến tính với các kiểu pixel dấu phẩy động cho texture.

Các phần mở rộng WebGL có sẵn bằng cách sử dụng phương thức WebGLRenderingContext.getExtension(). Để biết thêm thông tin, xem Sử dụng Phần mở rộng trong hướng dẫn WebGL.

Note: Phần mở rộng này có sẵn cho cả ngữ cảnh WebGL1WebGL2.

Lọc tuyến tính

Phần mở rộng OES_texture_float một mình không cho phép lọc tuyến tính với texture dấu phẩy động. Phần mở rộng này cho phép khả năng này.

Với sự giúp đỡ của phần mở rộng này, bạn có thể đặt bộ lọc phóng to hoặc thu nhỏ trong phương thức WebGLRenderingContext.texParameter() thành một trong gl.LINEAR, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR hoặc gl.LINEAR_MIPMAP_LINEAR và sử dụng texture dấu phẩy động.

Ví dụ

js
gl.getExtension("OES_texture_float");
gl.getExtension("OES_texture_float_linear");

const texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);

gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.FLOAT, image);

Thông số kỹ thuật

Specification
WebGL OES_texture_float_linear Khronos Ratified Extension Specification

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

Xem thêm