Rewrite WebGL common code as module "graph3d"