Fixing some argument order issues; fixing GLSharing on Mac OS X

Fixes bugs #553, #824 and #825 on Bugzilla.