Initial porting of the texture packing algorithm.