 (ns gamma-driver.drivers.basic
   (:require
     [gamma-driver.api :as gd]
-    [gamma-driver.protocols :as gdp]))
+    [gamma-driver.protocols :as gdp]
+    [goog.webgl :as ggl]))
 
 
 

  ([driver program opts target]
   (if-let [missing-inputs (input-incomplete? driver program)]
     (throw (js/Error. (str "Program '" (pr-str (:id program)) "' inputs are incomplete."  (pr-str (map (juxt :name :type) missing-inputs)))))
     (gd/draw-elements
      (gdp/gl driver)
       program
       ;; should supply below as an arg, with defaults
       {:draw-mode  (:draw-mode opts :triangles)
        :first      0
        ;; Should we just throw an error if :index-type isn't specified,
        ;; rather than default to :unsigned-short?  Seems kinder.
        :index-type :unsigned-short
        :count      (:count opts)}
       target))))






(defn input [driver program binder-fn variable new-spec]
  (let [{:keys [input-fn input-state]} driver]
    (if (= :element-index (:tag variable))
      (let [old-spec (get-in @input-state [program variable] {})
            new-spec (input-fn driver program binder-fn variable old-spec new-spec)]
        (swap! input-state assoc-in [program variable] new-spec)
        (swap! input-state assoc-in [variable] new-spec))
      (let [old-spec (get-in @input-state [program variable] {})
            new-spec (input-fn driver program binder-fn variable old-spec new-spec)]
        (swap! input-state assoc-in [program variable] new-spec)))))



(defn default-input-fn [driver program binder-fn variable old-spec new-spec]
