The second header line names the format of every pixel in the file. A pixel is 1, 2 or 4 bytes, and the same size for every level. A pixel of two or four bytes is big-endian: the first byte holds the highest bits, so in a format with alpha the alpha comes first in the file. In the layouts below the highest bit is on the left.
The formats
| Name | Bytes | Layout, highest bit first | Table | Glide number | Distinct files checked |
|---|---|---|---|---|---|
| rgb332 | 1 | red 3, green 3, blue 2 | none | 0 | 1 |
| yiq | 1 | Y 4, I 2, Q 2 | YIQ | 1 | 4 |
| a8 | 1 | alpha 8 | none | 2 | 14 |
| i8 | 1 | intensity 8 | none | 3 | 0 |
| ai44 | 1 | alpha 4, intensity 4 | none | 4 | 0 |
| p8 | 1 | palette index 8 | palette | 5 | 2 |
| argb8332 | 2 | alpha 8, red 3, green 3, blue 2 | none | 8 | 4 |
| ayiq8422 | 2 | alpha 8, Y 4, I 2, Q 2 | YIQ | 9 | 8 |
| rgb565 | 2 | red 5, green 6, blue 5 | none | 10 (0A) | 158 |
| argb1555 | 2 | alpha 1, red 5, green 5, blue 5 | none | 11 (0B) | 5 |
| argb4444 | 2 | alpha 4, red 4, green 4, blue 4 | none | 12 (0C) | 14 |
| ai88 | 2 | alpha 8, intensity 8 | none | 13 (0D) | 0 |
| ap88 | 2 | alpha 8, palette index 8 | palette | 14 (0E) | 1 |
| argb8888 | 4 | alpha 8, red 8, green 8, blue 8 | none | none | 1 |
The Glide number is the value of GR_TEXFMT_* in Glide’s glide.h,
which the file’s format name stands for; the file itself holds the name, not the
number. The Glide 2 header has no format for argb8888 (number 15 is reserved).
The last column counts the distinct files among the 212 checked for this reference.
The formats with 0 files, i8, ai44 and ai88,
are not checked against a file: their layouts follow the Glide header and the
pattern of the others.
Turning a field into 8 bits
A field of fewer than 8 bits has to be widened to the 0 to 255 range to be shown.
The explorer repeats the top bits into the low ones: a 5-bit value v
becomes (v << 3) | (v >> 2), a 6-bit value
(v << 2) | (v >> 4), a 4-bit value v × 17, a 2-bit
value v × 85, and a 3-bit value (v << 5) | (v << 2) |
(v >> 1). This is the explorer’s choice, which keeps 0 as 0 and the largest
value as 255; the file does not say how a card widens them.
rgb332
One byte, RRRGGGBB: red in bits 7 to 5, green in bits 4 to 2 and blue
in bits 1 to 0.
yiq
One byte, YYYYIIQQ: a 4-bit index into the Y table, a 2-bit index into
the I table and a 2-bit index into the Q table, which sit in the
YIQ table between the header and
the pixels. The colour is Y + I + Q, channel by channel. Because the tables belong to
the texture, each texture can have its own set of 16 brightnesses and 4 + 4 colour shifts.
a8
One byte of alpha, 0 to 255, with no colour. The explorer shows it as grey, 255 as white. How the alpha is used is up to the program that loads it; these files are typically masks.
i8
One byte of intensity, 0 to 255: a grey. No file with this format was available to check.
ai44
One byte with alpha in the high four bits and intensity in the low four,
AAAAIIII. No file with this format was available to check, so the order of
the two halves follows Glide’s name (alpha, then intensity) and is not confirmed.
p8
One byte, an index into the 256-entry palette that sits between the header and the pixels. There is no alpha.
argb8332
Two bytes, big-endian: the first byte is the alpha, the second is
RRRGGGBB as in rgb332. The alpha is 0 in every pixel of some files.
ayiq8422
Two bytes: the first is the alpha, the second is a yiq byte,
YYYYIIQQ, decoded with the file’s YIQ table.
rgb565
Two bytes, a big-endian 16-bit number RRRRRGGGGGGBBBBB. By far the most
common format in the files checked, and the native 16-bit format of the Voodoo cards.
Example: the bytes 49 E4 are the number 49E4, red 9, green 15,
blue 4. Read little-endian the same data shows speckled noise, which is how the byte
order was settled.
argb1555
Two bytes, ARRRRRGGGGGBBBBB: a 1-bit alpha (0 transparent, 1 opaque)
in the top bit, then 5 bits each of red, green and blue.
argb4444
Two bytes, AAAARRRRGGGGBBBB: four bits for each channel.
ai88
Two bytes: the first is the alpha and the second the intensity. No file with this format was available to check; the order follows the other 16-bit alpha formats (argb8332, ayiq8422 and ap88, which do hold the alpha first).
ap88
Two bytes: the first is the alpha and the second an index into the palette. The palette entries also have an alpha byte, which is 0 in the file checked.
argb8888
Four bytes in the order alpha, red, green, blue: a big-endian 32-bit number
0xAARRGGBB. One file of this format was checked.
Alpha in the files
Many of the files with an alpha channel store alpha 0 in every pixel: the texture was made from a picture with no transparency and the alpha was left at zero. The explorer therefore draws the colours of a level as if they were opaque and shows the alpha of the largest level as a separate grey picture. A file made for transparency, such as a plant in ayiq8422 (a 64 × 128 texture from a Glide demo’s plant models), has the plant’s outline in its alpha.