TextureFilter

View source

Selects how WebGL samples a texture between texels and mip levels.

Pass a member to WebGLRenderingContext#texParameteri with TEXTURE_MIN_FILTER or TEXTURE_MAG_FILTER. The four mipmap members are minification filters; use Nearest or Linear for magnification.

Examples

import { TextureFilter } from '@wimaengine/render-webgl'

gl.texParameteri(
  gl.TEXTURE_2D,
  gl.TEXTURE_MIN_FILTER,
  TextureFilter.LINEAR_MIPMAP_LINEAR
)
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, TextureFilter.Linear)

Variants


Nearest

View source

Selects the nearest texel without mipmaps (0x2600, NEAREST).

Linear

View source

Interpolates neighboring texels without mipmaps (0x2601, LINEAR).

NEAREST_MIPMAP_NEAREST

View source

Uses the nearest texel from the nearest mip level (0x2700, NEAREST_MIPMAP_NEAREST).

LINEAR_MIPMAP_NEAREST

View source

Interpolates texels in the nearest mip level (0x2701, LINEAR_MIPMAP_NEAREST).

NEAREST_MIPMAP_LINEAR

View source

Uses nearest-texel sampling while blending the two nearest mip levels (0x2702, NEAREST_MIPMAP_LINEAR).

LINEAR_MIPMAP_LINEAR

View source

Interpolates texels and blends the two nearest mip levels (0x2703, LINEAR_MIPMAP_LINEAR).