Added function to save 2D and cube map texture.