This PR gets the code working on a stock install of Ubuntu 13.04 with nVidia graphics. It's fairly ugly but we can de-uglify as time goes on.