Introduction of gl context and format globals in an attempt to fix things (?)