 (def char-callback-atom (atom nil))
 (def mouse-button-callback-atom (atom nil))
 (def cursor-pos-callback-atom (atom nil))
+
+(defn flip-byte-buffer [^ByteBuffer byte-buffer]
+  (let [buffer ^Buffer byte-buffer]
+    (.flip buffer)
+    byte-buffer))
+
+(defn flip-float-buffer [^FloatBuffer float-buffer]
+  (let [buffer ^Buffer float-buffer]
+    (.flip buffer)
+    float-buffer))
 
 (defmacro with-gl-context
   "Executes exprs in an implicit do, while holding the monitor of x and aquiring/releasing the OpenGL context.

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

  (: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
