Move temporary texture creation out of main loop