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

ExternalTexture

Quick answer

ExternalTexture binds a video element or VideoFrame as a texture without copying pixels into GPU memory. Create it with device.createExternalTexture({source, sampler}), then sample it like any texture. It suits live camera feeds and video layers, whereas static images belong in a regular Texture.

Last verified 2026-11-03 · luma.gl 9.4 · Cite this page
device. createExternalTexture ({ source, sampler }) → ExternalTexture
Key points
Example
const video = document.querySelector('video');
await video.play();

const videoTexture = device.createExternalTexture({
  source: video,
  sampler: {
    minFilter: 'linear',
    magFilter: 'linear',
    addressModeU: 'clamp-to-edge',
    addressModeV: 'clamp-to-edge'
  }
});

const model = new Model(device, {
  vs: screenVS,
  fs: screenFS,
  bindings: {
    uVideo: videoTexture,
    uVideoSampler: videoTexture.sampler
  },
  vertexCount: 6,
  topology: 'triangle-list'
});
let lastStamp = -1;

function frame() {
  if (videoTexture.updateTimestamp !== lastStamp) {
    lastStamp = videoTexture.updateTimestamp;

    const pass = device.beginRenderPass({ clearColor: [0, 0, 0, 1] });
    model.draw(pass);
    pass.end();
    device.submit();
  }

  requestAnimationFrame(frame);
}

frame();
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). ExternalTexture. https://www.jingweizhi.com/en/lumagl/api/external-texture.html (accessed 2026-11-03).