Opengl fixes

Merge with master, and add some fixes to make it work nicely for me.