TEXTURE1 and TEXTURE2

The TEXTURE1 and TEXTURE2 lumps define how wall patches from the WAD file should combine to form wall textures.

In other words, a texture is is decomposed into smaller textures in such a way that repeating areas are only stored once. At startup time (to be precise, during "R_Init: Init DOOM refresh daemon"), the patches inside the WAD are read and combined into Wall Textures, or how the source code refers to, 'map textures'.

Binary data
The binary contents of the TEXTURE1 and TEXTURE2 lumps start with a header of flexible size, followed by all of the map textures.

All integers are 4 bytes long in x86-style little-endian order. Their values can never exceed 231-1, since Doom reads them as signed ints. Short integers are 2 bytes long and are otherwise equal to integers.

Map textures structure, binary data
The binary contents of the maptexture_t structure starts with a header of 22 bytes, followed by all the the map patches.

Map patches structure, binary data
The binary contents of the mappatch_t structure contains 10 bytes defining how the patch should be drawn inside the texture.

Other formats
The TEXTUREx format above is used in the all versions of Doom since the the 0.5 alpha, Heretic, and Hexen, as well as the "teaser" and 1.0 versions of Strife.

The earlier alpha versions of Doom and v1.1 of the Strife IWAD have different formats.

Doom 0.2
This version has no TEXTUREx lump at all; and instead displays patches directly on the walls.

Doom 0.4
This version has a single TEXTURES lump with a "nameless" format.

Strife 1.1 and above
These have a shortened format with unused bits removed.

Text formats
DeuTex uses a combined PNAMES + TEXTUREx format to output extracted textures or recreate a texture lump. The format is simple: ;Comment TextureName		Width	Height *	PatchName	Xoffset	Yoffset If a line starts with a name, it is a new texture. If it starts with an asterisk, it is a patch to add to the last texture. If it starts with a semi-colon, it is ignored as a comment. Patch names are used directly and the PNAMES table is then rebuilt by numbering them in order of appearance. The numbers that follow a texture names are understood as its dimensions, while the numbers that follow a patch name are understood as its offsets.

Doom source ports such as Doomsday and ZDoom have introduced new text based formats for textures for textures which allows many additional effects to be performed, such as patch rotation or mirroring, as well as altering colors with a translation or a blending.