Function loadKtxTexture2D
-
loadKtxTexture2D(
engine: EngineContext,
baseUrl: string,
suffixes: string[],
opts?: Texture2DOptions,
): Promise<Texture2D>Parameters
- engine: EngineContext
The engine context (device must have compressed texture features enabled).
- baseUrl: string
The fallback image URL (e.g. "textures/grid.png").
- suffixes: string[]
KTX suffixes to try in priority order (e.g. ["-astc.ktx", "-dxt.ktx", "-etc2.ktx"]).
- opts: Texture2DOptions = {}
Texture options (sampler, address mode, etc.).
mipMapsis ignored — KTX mips are used as-is.
Returns Promise<Texture2D>
A Texture2D (same interface whether compressed or fallback).
- engine: EngineContext
Load a texture with KTX compressed format auto-selection and fallback.
Tries each suffix in priority order, picks the first whose compressed format the GPU supports, fetches and parses the KTX1 file, and uploads it as a compressed GPU texture. Falls back to the base URL (loaded as a regular image) if no suffix is supported or loading fails.