Fix redeclared gl functions for windows build
fix init gl funtions for windows build
fix opengl linking for macosx
improved gl init
Merge branch 'master' into stable