             [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]))

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

(defn main []
  (om/root
   (fn [app owner]
     (reify
       om/IRender
       (render [_]
         (dom/div nil
                  (dom/h2 #js{:onClick (fn [event] (om/transact! app :reverse? not))}
                          title)
                  (om/build canvas (:text app) {:opts {:cb (fn [gl node]
                                                             (gl-main gl node))}})
                  (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"))}))

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

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

