mirror of
https://github.com/visgl/luma.gl.git
synced 2025-12-08 17:36:19 +00:00
29 lines
761 B
Markdown
29 lines
761 B
Markdown
# ExternalTexture
|
|
|
|
> This is the proposed new luma.gl v9 API, which is currently open for comments. It is available for testing using luma.gl v9 alpha releases.
|
|
|
|
> WebGPU only
|
|
|
|
While it is possible to use a normal `Texture` for a video element, the `ExternalTexture`
|
|
class provides a way to create a cheap-to-construct, disposable view of the video.
|
|
|
|
The performance and memory savings can be significant.
|
|
|
|
Since a new external texture is created every frame, new bindings must be prepared:
|
|
|
|
```typescript
|
|
function onFrame() {
|
|
requestAnimationFrame(onFrame);
|
|
|
|
const externalTexture = device.createExternalTexture({source: video});
|
|
|
|
model.setBindings([
|
|
externalTexture,
|
|
sampler
|
|
])
|
|
|
|
model.draw(renderPass);
|
|
}
|
|
requestAnimationFrame(onFrame);
|
|
```
|