The detail and the perfectionist nature of the remastering of the texture management code in FitzQuake has been a very educational experience in seeing all the pitfalls and perils involved.
static byte *TexMgr_PadImageH (byte *in, int width, int height, byte padbyte) // I think this merely pads the image, but didn't check to see
static byte *TexMgr_PadImageW (byte *in, int width, int height, byte padbyte) // I think this merely pads the image, but didn't check to see
static gltexture_t *TexMgr_FindTexture (model_t *owner, char *name) // Returns the texture info structure (including glnum) for a model where the name matches
static gltexture_t *TexMgr_NewTexture (void) // Generates a new texture (glgentexture) and returns the new texture structure
static int TexMgr_Pad (int s) // Returns smallest power of 2 texture size for a given texture (OpenGL 1.2 only supports power of 2 sized textures without an extension)
static int TexMgr_SafeTextureSize (int s) // Returns safe texture size based on hardware and the user preferences (gl_maxsize)
static unsigned *TexMgr_8to32 (byte *in, int pixels, unsigned int *usepal) // converts bytes to GL_RGBA (ie 8-bit to 32 bit rgb plus alpha)
static unsigned *TexMgr_MipMapH (unsigned *data, int width, int height) // Mipmaps a texture, only done by TexMgr_LoadImage32, which as expected is called by TexMgr_LoadImage8
static unsigned *TexMgr_MipMapW (unsigned *data, int width, int height) // Mipmaps a texture, only done by TexMgr_LoadImage32, which as expected is called by TexMgr_LoadImage8
static unsigned *TexMgr_ResampleTexture (unsigned *in, int inwidth, int inheight, qboolean alpha) // resamples the texture to specified desired size (the bytes of data)
static void GL_SelectTexture (GLenum target)
static void TexMgr_AlphaEdgeFix (byte *data, int width, int height) // "eliminate pink edges on sprites and etc" Probably a finishing touch to fix resampling issues
static void TexMgr_Anisotropy_f (void) // on all the textures
static void TexMgr_DescribeTextureModes_f (void) // prints the texturemode constants to the console
static void TexMgr_FreeTextures (int flags, int mask) // probably frees the world textures and leaves the 2d textures as is
static void TexMgr_Imagelist_f (void) // command that prints texture (and lightmap) information (image x by y, type of texture (map, model, sprite owner and frame, etc.) and texture name
static void TexMgr_LoadImage32 (gltexture_t *glt, unsigned *data)
static void TexMgr_LoadImage8 (gltexture_t *glt, byte *data)
static void TexMgr_LoadLightmap (gltexture_t *glt, byte *data)
static void TexMgr_LoadPalette (void)
static void TexMgr_PadEdgeFixH (byte *data, int width, int height)
static void TexMgr_PadEdgeFixW (byte *data, int width, int height)
static void TexMgr_SetFilterModes (gltexture_t *glt) // Sets the filtermode for a specific texture (but is always run against several in a for loop except for individual lightmaps)
static void TexMgr_TextureMode_f (void) // Sets the texture mode, which then runs setfiltermode against all textures
void GL_Bind (gltexture_t *texture) // used a lot, tells OpenGL (via glBindTexture) which 2d texture to work with/draw with
void GL_DisableMultitexture(void) // used a lot
void GL_EnableMultitexture(void) // used a lot
void TexMgr_FreeTexture (gltexture_t *kill) // deletes the texture (glDeleteTextures) and does the supporting removal finessing
void TexMgr_FreeTexturesForOwner (model_t *owner) // Called by TexMgr_NewGame, which is called on a gamedir change (but not on initialization)
void TexMgr_Init (void) // called by host_init
void TexMgr_NewGame (void) // called only on gamedir change, not initialization
void TexMgr_RecalcWarpImageSize (void) // warp image size recalc for the actual 2d screen resolution of the gl window (NOT the 2d graphics width), called by init and vid_restart
void TexMgr_ReloadImage (gltexture_t *glt, int shirt, int pants) // Looks like it recolorizes the texture
void TexMgr_ReloadImages (void) // Reloads all the (active) texture images, only called by vid_restart
float TexMgr_FrameUsage (void) // r_speeds 2, prints texture memory usage
gltexture_t *TexMgr_LoadImage (model_t *owner, char *name, int width, int height, enum srcformat format, byte *data, char *source_file, unsigned source_offset, unsigned flags) // single entry point for all textures
int TexMgr_PadConditional (int s) // Pads a texture if it needs it