Intermediate check-in of rework to webgl.js. Refactoring nearly complete but no testing performed.