Function UploadHtmlElementToTexture
-
UploadHtmlElementToTexture(
engine: AbstractEngine,
texture: Nullable<InternalTexture>,
element: any,
invertY?: boolean,
config?: any,
): booleanParameters
- engine: AbstractEngine
defines the engine that owns the texture
- texture: Nullable<InternalTexture>
defines the internal texture to update
- element: any
defines the source HTML element (or captured ElementImage) to upload
- invertY: boolean = true
defines if data must be stored with Y axis inverted (true by default)
Optionalconfig: anydefines an optional source rectangle and sizing configuration
Returns boolean
true if the upload succeeded, false otherwise (e.g. the API is unavailable)
- engine: AbstractEngine
Uploads a live HTML element (or a captured ElementImage) into an existing 2D texture using the WICG HTML-in-Canvas API (https://github.com/WICG/html-in-canvas).
This is a side-effect-free helper - it is only reachable when HtmlTexture (or a direct caller) is imported, so it adds nothing to bundles that do not use it. It relies on
WebGLRenderingContext.texElementImage2D(WebGL) orGPUQueue.copyElementImageToTexture(WebGPU), available either natively (behind chrome://flags/#canvas-draw-element) or through the three-html-render polyfill.