Introduction
KTX 1 is the first version of the Khronos Group’s texture container, made for OpenGL and OpenGL ES. It stores a texture in exactly the form that is passed to OpenGL’s texture upload calls, so a loader can read the header, then hand each mipmap level straight to the driver. One file can hold a 1D, 2D or 3D texture, a cube map or an array, with all its mipmap levels.
Each texture is described with OpenGL’s own numbers: the type, format and internal
format constants such as GL_UNSIGNED_BYTE, GL_RGBA or a
compressed format such as ETC2. KTX 2 replaced it for Vulkan, but KTX 1 files are still
common in OpenGL ES and Android projects.
Structure
A 12-byte identifier is followed by an endianness word and twelve 32-bit fields. Then come the key and value pairs, and then each mipmap level, largest first, each preceded by its size. The file layout page has every field.
0Identifier «KTX 11»12 bytes12Endianness0x04030201as written4 bytes16Header OpenGL type and formats, size, counts48 bytes64Key and value data pairs, each padded to 4 bytesvaries…Mipmap levels each with a 4-byte size first, largest firstvaries
Variants
- Khronos Texture 1 – OpenGL textures described by OpenGL constants, in either byte order
- Khronos Texture 2 – Vulkan textures with a data format descriptor and optional supercompression
Links
Software
- KTX-Software tools – Khronos command-line tools that create, check and convert KTX files (Windows, macOS, Linux)
- PVRTexTool – Imagination Technologies’ texture compression and viewing tool (Windows, macOS, Linux)
- Compressonator – AMD’s texture compression tool (Windows, Linux)
Developers
- libktx – Khronos library that reads and writes KTX 1 and KTX 2 (C)
Reference
- KTX File Format Specification – the Khronos specification of KTX 1