       (doseq [[[s underline?] col row]  character-idxs]
         (let [x ^int (* col char-width)
               y ^int (* (inc row) char-height)
-              #_#_cx (+ 0 x)
-              #_#_cy (+ 12 y)]
+              cx (+ 1 x)
+              cy (- y (.getDescent font-metrics))]
           ;(log/info s x y)
         (when (not= s " ")
           ;(println "drawing" s "@" x y "underline?" underline?)
           (doto texture-graphics
             (.setColor white)
-            (.drawString (str s) x y)))
+            (.drawString (str s) cx cy)))
         (when underline?
           (let [y (dec y)]
             (doto texture-graphics

;; Normally this would be a record, but until http://dev.clojure.org/jira/browse/CLJ-1224 is fixed
;; it is not performant to memoize records because hashCode values are not cached and are recalculated
;; each time.
(defn make-terminal-character
  [character fg-color bg-color style]
  {:character character
   :fg-color  fg-color
   :bg-color  bg-color
   :style     style})

(defrecord OpenGlTerminal [^int columns
                           ^int rows
                           ^int texture-columns
                           ^int texture-rows
                           character-map-cleared
                           character-map
                           cursor-xy

  (:import
    (java.lang.reflect Field)
    (java.awt Color
              Canvas
              Color
              Font
              FontMetrics
              Graphics
              Image
              RenderingHints)
    (java.awt.event KeyEvent)
    (org.lwjgl BufferUtils LWJGLUtil)
    (java.nio FloatBuffer ByteBuffer)
    (org.lwjgl.opengl Display ContextAttribs
                      PixelFormat DisplayMode
