fix init gl funtions for windows build
fix opengl linking for macosx
improved gl init
merge with master
merge with master