Fix some GL bugs, and some other stuff.
More random changes that keep appearing in too big commits.