let get_tex tex =
let rec f map =
match map with [] -> failwith "texture not found in list."
| x::xs ->
let (mtex, mind) = x in
if mtex == tex then mind else f xs
in f (!tex_index_map)