                             (sh/make-shader-from-spec gl))}
                       (buf/make-attribute-buffers-in-spec gl gl/static-draw))))
 
-(defn ^:export start []
+(defn ^:export start
+  "This function is called when `index.html` is loaded. We use it to kick off the mouse tracking function and the animation loop."
+  []
   (.addEventListener
    js/document "mousemove"
    #(do

            [thi.ng.geom.webgl.animator :refer [animate]]
            [thi.ng.geom.webgl.shaders.basic :as basic]))

(defonce mouse-x (atom 0))
(defonce mouse-y (atom 0))

(defonce gl (gl/gl-context "main"))
(defonce view-rect (gl/get-viewport-rect gl))

(def model
  (let [vertices (map #(* % (+ 0.3 (* 0.3 (rand)))) [1 -1 1 1 -1 -1 1 1 -1 1 -1 1 1 1 -1 1 1 1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 1 1 1 1 -1 1 -1 1 1 1 1 1 -1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 -1])
        colors   (flatten (map (partial repeat 6)
                               [[0.9 0.3 0.3 1]
                                [0.3 0.9 0.3 1]

                                [0.9 0.9 0.3 1]
                                [0.9 0.3 0.9 1]
                                [0.0 0.9 0.9 1]]))]
    ;; ... and then pack it all into a data structure that geom's
    ;; WebGL interface understands
    (-> {:attribs {:position {:data (arrays/float32 vertices) :size 3}
                   :color    {:data (arrays/float32 colors) :size 4}}
         :uniforms     {:proj (gl/perspective 45 view-rect 0.1 100.0)
