         (assert (not (nil? font-texture-width)) "font-texture-width nil")
         (assert (not (nil? font-texture-height)) "font-texture-height")
         (assert (not (nil? font-texture)) "font-texture nil")
-        (doseq [[{:keys [columns rows layers]}
+        (log/info "drawing with" (mapv vec [glyph-textures fg-textures bg-textures glyph-image-data fg-image-data bg-image-data]))
+        ;; Setup render to FBO
+        (try
+          (GL30/glBindFramebuffer GL30/GL_FRAMEBUFFER, fbo-id)
+          (GL30/glEnablei GL11/GL_BLEND fbo-id)
+          (GL14/glBlendFuncSeparate GL11/GL_SRC_ALPHA GL11/GL_ONE_MINUS_SRC_ALPHA GL11/GL_ONE GL11/GL_ONE_MINUS_SRC_ALPHA)
+          (GL11/glViewport 0 0 framebuffer-width framebuffer-height)
+          (except-gl-errors (str "glViewport " framebuffer-width framebuffer-height))
+          (GL11/glClearColor 0.0 0.0 1.0 1.0)
+          (except-gl-errors (str "glClearColor  " 0.0 0.0 1.0 1.0))
+          (GL11/glClear (bit-or GL11/GL_COLOR_BUFFER_BIT GL11/GL_DEPTH_BUFFER_BIT))
+          (except-gl-errors (str "glClear  " (bit-or GL11/GL_COLOR_BUFFER_BIT GL11/GL_DEPTH_BUFFER_BIT)))
+          (GL20/glUseProgram program-id)
+          (GL20/glUniformMatrix4fv u-PMatrix false (ortho-matrix-buffer framebuffer-width framebuffer-height p-matrix-buffer))
+          (except-gl-errors (str "u-PMatrix - glUniformMatrix4  " u-PMatrix))
+          ; Bind VAO
+          (GL30/glBindVertexArray vao-id)
+          (except-gl-errors (str "vao bind - glBindVertexArray " vao-id))
+          ; Setup vertex buffer
+          (except-gl-errors (str "vbo bind - glBindBuffer " vertices-vbo-id))
+          (GL20/glEnableVertexAttribArray 0);pos-vertex-attribute
+          (except-gl-errors "vbo bind - glEnableVertexAttribArray")
+          (except-gl-errors "vbo bind - glVertexAttribPointer")
+          ; Setup uv buffer
+          (GL20/glEnableVertexAttribArray 1);texture-coords-vertex-attribute
+          (except-gl-errors "texture coords bind")
+          ; Setup font texture
+          (GL13/glActiveTexture GL13/GL_TEXTURE0)
+          (except-gl-errors "font texture glActiveTexture")
+          (GL11/glBindTexture GL11/GL_TEXTURE_2D font-texture)
+          (except-gl-errors "font texture glBindTexture")
+          (GL20/glUniform1i u-font 0)
+          (except-gl-errors "font texture glUniform1i")
+          (catch Error e
+           (log/error "OpenGL error:" e)))
+        ;; Render each layer to FBO
+        (doseq [[{:keys [columns rows layers] [x-pos y-pos] :pos}
                  glyph-texture
                  fg-texture
                  bg-texture

     :texture-coords-vbo-id texture-coords-vbo-id
     :texture-coords-count texture-coords-count
     :vao-id vao-id}))

;; 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

    (org.lwjgl BufferUtils)
    (java.nio FloatBuffer ByteBuffer)
    (java.nio.charset Charset)
    (org.lwjgl.opengl GL GLUtil GL11 GL12 GL13 GL14 GL15 GL20 GL30 GL32)
    (org.lwjgl.glfw GLFW GLFWVidMode GLFWErrorCallback GLFWCharCallback GLFWKeyCallback GLFWMouseButtonCallback GLFWCursorPosCallback)
    (org.lwjgl.system Platform)
    (org.joml Matrix4f Vector3f)
