(define gl-loop
(lambda (time delta-t)
(gl_render)
;; this won't work in Scheme
;; (glfw_swap_buffers window)
(let* ((cb-lookahead 0.1)
(t (+ (now) (* cb-lookahead delta-t *second*)))
(missed-frames (quotient (real->integer (- t time))
(real->integer (* delta-t *second*))))
(newtime (+ time (* (* (+ missed-frames 2) delta-t) *second*))))
(if (> missed-frames 0)
(begin (print-with-colors *impc:compiler:pretty-print-error-color* 'default #t
(print "Warning"))
(print ": ")
(print-with-colors *impc:compiler:pretty-print-name-color* 'default #t
(print "gl-loop"))
(print " couldn't handle the load, dropped ")
(print-with-colors *impc:compiler:pretty-print-code-color* 'default #f
(print missed-frames))
(print " frames\n")))
(callback (* newtime cb-lookahead) 'gl-loop newtime delta-t))))