HtmlVideoTexture

class HtmlVideoTexture(val video: HTMLVideoElement, width: Int, height: Int) : Texture

Web (js + wasmJs) earth.worldwind.render.Texture that mirrors a playing HTMLVideoElement onto a GL_TEXTURE_2D sampler. Each bindTexture call uploads the latest decoded frame via the native WebGL texImage2D(target, level, internalFormat, format, type, HTMLVideoElement) overload — the browser handles decoding and color-space conversion; no CPU pixel copy.

Sampled with the standard earth.worldwind.render.program.SurfaceQuadShaderProgram / sampler2D path — no extension or OES variant. Caller controls playback (video.play() / video.pause() / video.currentTime); we skip uploads while video.readyState < HAVE_CURRENT_DATA so the texture stays at the last successful frame during seeks/buffering.

Redraw triggering. Other backends in this set call WorldWind.requestRedraw from their submitFrame path; here, the texture has nothing to publish — it draws straight from HTMLVideoElement on each bind. We instead register a requestVideoFrameCallback listener (per-decoded-frame, no busy-poll), with a requestAnimationFrame fallback for browsers that don't expose it (older Firefox). Each callback triggers WorldWind.requestRedraw(), which fires the engine's render path → bindTexture → texImage2D(... video) → fresh frame on screen.

Constructors

Link copied to clipboard
constructor(video: HTMLVideoElement, width: Int, height: Int)

Properties

Link copied to clipboard
Link copied to clipboard
val coordTransform: Matrix3
Link copied to clipboard

Caller opt-out for mipmap generation.

Link copied to clipboard
val height: Int
Link copied to clipboard
val target: Int
Link copied to clipboard
Link copied to clipboard
val width: Int

Functions

Link copied to clipboard
open override fun bindTexture(dc: DrawContext): Boolean
Link copied to clipboard
fun getTexParameter(name: Int): Int
Link copied to clipboard
fun getTextureName(dc: DrawContext): KglTexture
Link copied to clipboard
open override fun release(dc: DrawContext)

Frees any resources associated with this instance. After this method returns the rendering resource is invalid, and any associated GL object is deleted.

Link copied to clipboard
fun setTexParameter(name: Int, param: Int)