(bind-func gl_draw_loop
(lambda (time:i64 delta_t:double)
(glClear GL_COLOR_BUFFER_BIT)
(glUseProgram sp)
(let ((loc (glGetUniformLocation sp "view_mat")))
(glUniformMatrix4fv loc 1 GL_FALSE (aref-ptr view_mat 0))
(VAO_bind_and_draw_arrays vao GL_TRIANGLES 0 3))
(glfwPollEvents)
(move_triangle window)
(glfwSwapBuffers window)
(if (= (glfwWindowShouldClose window) 1)
(begin (glfwDestroyWindow window)
(println "Window closed, stopping draw loop."))
(let ((next_time (+ time (convert (* 44100. delta_t)))))
(callback next_time gl_draw_loop next_time delta_t)))))