Factorize GL state changes to get better performances.