assertion before gl declaration throws an exception

swapping lines fixes the problem