glutleavemainloop now with correct behaviour