There might be various error flags and we need to clear all of them to get precise error results. Thus, we need to call glGetError in a loop to achieve that.
This backend is based on ideas of the old OpenGL backend, of the Android GL backend and of the iPhone GL backend.