         tri-glyphs (triangle-glyphs tri-pts tri-orients)]
    {:b-array (byte-array PIX-CNT1)
     :i-array (int-array PIX-CNT2)
-    :frame-mat (Mat. WIDTH HEIGHT CvType/CV_8UC3)
-    :output-mat (Mat. WIDTH HEIGHT CvType/CV_8UC4)
+    :frame-mat (Mat. HEIGHT WIDTH CvType/CV_8UC3)
+    :output-mat (Mat. HEIGHT WIDTH CvType/CV_8UC4)
     :gray-mat (Mat.)
     :rgba-mat (Mat.)
+    :drawn-mat (Mat. HEIGHT WIDTH CvType/CV_8UC4)
     :camera (cv/camera 0)
     :p-image (q/create-image WIDTH HEIGHT :rgb)
     :triangle-points tri-pts

                         color
                         glyph-pts]
  (let [poly (MatOfPoint.)
        c (apply #(let [r %1
                        g %2
                        b %3
                        a %4]
                    (Scalar. b g r))
                 color)]
    (.fromList poly (ArrayList. glyph-pts))
    (Core/fillPoly img-mat (ArrayList. [poly]) c)))

(defn draw-mosaic-pair
  [triangle-glyphs frame-mat rgba-mat [pt1 pt2]]
  (let [color-fn (fn [mat-col mat-row]
                   (let [c (.get rgba-mat
                                 (+ mat-row MOSAIC-BIN-SIZE-2)

      
      (update-rgba)
      (overlay-triangles)
      (update-drawn-p-image)))

(defn draw [state]
  (let [{:keys [p-image frame-mat]} state]
