glfun: exported GL related functions to a new file

Should tidy up main.c a bit.