           _                (info "Using font" (.getFontName normal-font))
           default-fg-color (Color. (long default-fg-color-r) (long default-fg-color-g) (long default-fg-color-b))
           default-bg-color (Color. (long default-bg-color-g) (long default-bg-color-g) (long default-bg-color-b))
+          ;; create texture atlas
+          _                (doseq [[c x y] character->pos]
+                             (canvas/text character-canvas {:text (str c) :x x :y y}))
           character-map    (atom (vec (repeat rows (vec (repeat columns (make-terminal-character \space default-fg-color default-bg-color #{}))))))
           cursor-xy        (atom nil)
-          ;; draws a character to an image and returns the image. 
-          glyph-cache      (memoize (fn [component font-metrics highlight char-width char-height c]
-                             (info "Creating glyph for" c)
-                             (let [glyph-image                       (.createImage component char-width char-height)
+          ;; draws a character using webgl. 
+          draw-character   (fn [ctx c [x y]]
+                             (info "Drawing character" c)
+                             #_(let [glyph-image                       (.createImage component char-width char-height)
                                    offscreen-graphics-2d ^Graphics2D (.getGraphics glyph-image)
                                    x                                 0
                                    y                                 (long (- char-height (.getDescent font-metrics)))

               "\u2500"
               "\u2500")))

(def character-layout
  (let [character-matrix (partition (int (inc (.sqrt js/Math (count characters)))) characters)]
    (mapcat

                                                char-width
                                                y))))
                               (.dispose offscreen-graphics-2d)
                               glyph-image))
          key-queue        (LinkedBlockingQueue.)
          on-key-fn        (or on-key-fn
                               (fn default-on-key-fn [k]
