Moved texture loading to its own function.