The function used bare 'gl' but it's a module-level closure, so gl wasn't defined inside the .then() callback. Added groundGl module variable, set it in initGroundSystem, used it everywhere in rebuildGroundMosaic instead of bare 'gl'.
The function used bare 'gl' but it's a module-level closure, so gl wasn't defined inside the .then() callback. Added groundGl module variable, set it in initGroundSystem, used it everywhere in rebuildGroundMosaic instead of bare 'gl'.