refactored image loading and conversion to texture