Fix glReadPixels for various cases.