Atlaslog
Atlaslog / luma.gl / API reference / Sampler
luma.gl · API reference

Sampler

Quick answer

Sampler fixes filtering, wrapping, mipmap range and anisotropy for texture reads. Create it with device.createSampler({minFilter, magFilter, addressModeU, addressModeV, mipmapFilter, maxAnisotropy}); the object is immutable, so changed settings need a new Sampler. Attach it to a Texture or pass it in bindings.

Last verified 2026-11-03 · luma.gl 9.4 · Cite this page
device. createSampler ( props ) → Sampler
Key points
Example
const sampler = device.createSampler({
  minFilter: 'linear',
  magFilter: 'linear',
  mipmapFilter: 'none',
  addressModeU: 'repeat',
  addressModeV: 'repeat'
});

const texture = device.createTexture({
  width: 64,
  height: 64,
  format: 'rgba8unorm',
  sampler: sampler
});

/* 换成钳制模式:只需替换纹理上的采样器 */
texture.setSampler({
  minFilter: 'linear',
  magFilter: 'linear',
  mipmapFilter: 'none',
  addressModeU: 'clamp-to-edge',
  addressModeV: 'clamp-to-edge'
});
Notes
Runnable examplesChinese originalAll API references
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Cite this page

Atlaslog (2026). Sampler. https://www.jingweizhi.com/en/lumagl/api/sampler.html (accessed 2026-11-03).