API

Function loadKtx2Texture2D

  • Fetch and decode a standalone KTX2 (Basis Universal) texture from a URL into a Texture2D, transcoded to the device's best GPU-compressed format (BC7/ETC2/ASTC) so it STAYS compressed in VRAM (a few times less than the uncompressed RGBA8 loadTexture2D always uploads). Mirrors loadKtxTexture2D (KTX1) for app textures that live outside a glTF. Requires the KTX2 decoder (configure self-hosting via setKtx2DecoderUrl). sRGB selects the *-srgb GPU format (default false: raw/linear sampling, matching loadTexture2D's srgb:false). The decoder uploads the stored mips as-is (no V-flip), so author the .ktx2 in the orientation you want.

    Parameters

    Returns Promise<Texture2D>