Optimized textures usage. Also optimized some GL state changes.