osx compilation

this is mostly to abstract out gl includes and fix minor little C errors