engine/EngineVideoTextureManager.c
/*	Must be called before any texture loading
*/
Must be called before any texture loading
Must be called before any texture loading
void TextureManager_Initialize(void)
{
	int			i;
	static uint8_t notexture_data[16] =
	{
		255,  0,255, 255,
		  0,  0,  0, 255,
		  0,  0,  0, 255,
		255,  0,255, 255
	}; 
	extern texture_t *r_notexture_mip, *r_notexture_mip2;
	Con_Printf("Initializing texture manager...\n");
	Image_InitializePNG();
	free_gltextures = (gltexture_t *) Hunk_AllocName (MAX_GLTEXTURES * sizeof(gltexture_t), "gltextures");
	active_gltextures = NULL;
	for (i=0; i<MAX_GLTEXTURES-1; i++)
		free_gltextures[i].next = &free_gltextures[i+1];
	free_gltextures[i].next = NULL;
	numgltextures = 0;
	Cvar_RegisterVariable (&gl_max_size, NULL);
	Cvar_RegisterVariable(&gl_picmip, &TexMgr_ReloadImages);
	Cvar_RegisterVariable (&gl_texture_anisotropy, &TexMgr_Anisotropy_f);
	Cmd_AddCommand ("gl_texturemode", &TexMgr_TextureMode_f);
	Cmd_AddCommand ("gl_describetexturemodes", &TexMgr_DescribeTextureModes_f);
	Cmd_AddCommand ("imagelist", &TexMgr_Imagelist_f);
	Cmd_AddCommand ("imagedump", &TexMgr_Imagedump_f);
	Cmd_AddCommand("image_reloadtextures", &TexMgr_ReloadImages);
	glGetIntegerv (GL_MAX_TEXTURE_SIZE, &gl_hardware_maxsize);
	notexture = TexMgr_LoadImage(NULL,"notexture",2,2,SRC_RGBA,notexture_data,"",(unsigned)notexture_data,TEXPREF_NEAREST|TEXPREF_PERSIST|TEXPREF_NOPICMIP);
	r_notexture_mip->gltexture = r_notexture_mip2->gltexture = notexture;
	gl_warpimagesize = 0;
	TexMgr_RecalcWarpImageSize ();
}
void TextureManager_Initialize ( void ) { int i ; static uint8_t notexture_data [ 16 ] = { 255 , 0 , 255 , 255 , 0 , 0 , 0 , 255 , 0 , 0 , 0 , 255 , 255 , 0 , 255 , 255 } ; extern texture_t * r_notexture_mip , * r_notexture_mip2 ; Con_Printf ( " \n " ) ; Image_InitializePNG ( ) ; free_gltextures = ( gltexture_t * ) Hunk_AllocName ( MAX_GLTEXTURES * sizeof ( gltexture_t ) , " " ) ; active_gltextures = NULL ; for ( i = 0 ; i < MAX_GLTEXTURES - 1 ; i ++ ) free_gltextures [ i ] . next = & free_gltextures [ i + 1 ] ; free_gltextures [ i ] . next = NULL ; numgltextures = 0 ; Cvar_RegisterVariable ( & gl_max_size , NULL ) ; Cvar_RegisterVariable ( & gl_picmip , & TexMgr_ReloadImages ) ; Cvar_RegisterVariable ( & gl_texture_anisotropy , & TexMgr_Anisotropy_f ) ; Cmd_AddCommand ( " " , & TexMgr_TextureMode_f ) ; Cmd_AddCommand ( " " , & TexMgr_DescribeTextureModes_f ) ; Cmd_AddCommand ( " " , & TexMgr_Imagelist_f ) ; Cmd_AddCommand ( " " , & TexMgr_Imagedump_f ) ; Cmd_AddCommand ( " " , & TexMgr_ReloadImages ) ; glGetIntegerv ( GL_MAX_TEXTURE_SIZE , & gl_hardware_maxsize ) ; notexture = TexMgr_LoadImage ( NULL , " " , 2 , 2 , SRC_RGBA , notexture_data , " " , ( unsigned ) notexture_data , TEXPREF_NEAREST | TEXPREF_PERSIST | TEXPREF_NOPICMIP ) ; r_notexture_mip -> gltexture = r_notexture_mip2 -> gltexture = notexture ; gl_warpimagesize = 0 ; TexMgr_RecalcWarpImageSize ( ) ; }
Must be called before any texture loading
Must be called before any texture loading
//black and pink checker // init texture list // poll max size from hardware //have to assign these here becuase Mod_Init is called before TexMgr_Init //set safe size for warpimages