OSX/OGL compilation and functionality fixes