Simplify and improve loadCubeMap function

While looking into the Mac cubemap problem, @shunter and I cleaned up the `loadCubeMap` function substantially.  It didn't fix the bug, but it's still worth getting into master.