Various GLES fixes
Incorporates the working commits from !171 (closed) (omitting the one that causes test failures), and some other fixes of my own that I came across while attempting to actually get the test framework to run on GLES (which I noticed it doesn't).