             [gampg.learn-gamma.lesson-08 :as lg08]
             [gampg.learn-gamma.lesson-09 :as lg09]
             [gampg.learn-gamma.lesson-10 :as lg10]
+            [gampg.learn-gamma.gltf :as lg-gltf]
             [goog.webgl :as ggl]
             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]))

;;
;; XXX: We're not properly reusing gl context's here, hurts fighweel's
;; reloadability
(def title   lg01/title)
(def prog    lg01/program-source)
(def gl-main lg01/main)

(defonce app-state (atom {:live {}}))


                      :style #js{:width "100%"
                                 :border (str "2px solid " (rand-nth ["black" "blue" "green" "pink"]))}}))))

(defn main* []
  (let [node (js/document.getElementById "glcanvas")
        gl   (.getContext node "webgl")]
    (om/root
     (fn [app owner]
       (reify
         om/IRender
         (render [_]
           (dom/div nil
                    (dom/h2 #js{:onClick (fn [event] (om/transact! app :reverse? not))}
                            title)
                    (dom/small nil
                               (dom/pre #js{:style #js{:float "left"
                                                       :borderRight "1px dotted black"
                                                       :width "45%"
                                                       :overflow "hidden"}}
                                        "Vertex Shader:\n--------------\n\n"
                                        (get-in prog [:vertex-shader :glsl])))
                    (dom/small nil
                               (dom/pre #js{:style #js{:width "50%"
                                                       :float "left"
                                                       :marginLeft 4
                                                       :paddingLeft 4}}
                                        "Fragment Shader:\n----------------\n"
                                        (get-in prog [:fragment-shader :glsl])))))))
     app-state
     {:target (. js/document (getElementById "app"))})
    (gl-main gl node)))

;; Temporarily here for debugging

(defn main []
  (let [node (js/document.getElementById "glcanvas")
        gl   (.getContext node "webgl")]
    (main*)))

(set! (.-reinstallApp js/window)
      (fn []
        (main*)))
