                                             0.0 0.0])
         vertices-buffer       (-> (BufferUtils/createFloatBuffer (count vertices))
                                   (.put vertices)
-                                  (.flip))
+                                  flip-float-buffer)
         texture-coords-buffer (-> (BufferUtils/createFloatBuffer (count texture-coords))
                                   (.put texture-coords)
-                                  (.flip))
+                                  flip-float-buffer)
         vertices-count        (count vertices)
         texture-coords-count  (count texture-coords)
         vao-id                (GL30/glGenVertexArrays)

(def char-callback-atom (atom nil))
(def mouse-button-callback-atom (atom nil))
(def cursor-pos-callback-atom (atom nil))

(defmacro with-gl-context
  "Executes exprs in an implicit do, while holding the monitor of x and aquiring/releasing the OpenGL context.

  (:import
    (java.lang.reflect Field)
    (org.lwjgl BufferUtils)
    (java.nio Buffer FloatBuffer ByteBuffer)
    (java.nio.charset Charset)
    (org.lwjgl.opengl GL GLUtil GL11 GL12 GL13 GL14 GL15 GL20 GL30 GL32)
    (org.lwjgl.glfw GLFW GLFWVidMode GLFWVidMode$Buffer GLFWImage GLFWImage$Buffer
