(bind-func gl_draw
(lambda ()
(glClear (+ GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT))
;; run the simulation
(world_step world)
;; update texture
(glTexSubImage2D GL_TEXTURE_2D 0 0 0
(convert (world_width world))
(convert (world_height world))
GL_RED
GL_BYTE
(world_data world))
;; draw the world
(let ((texloc (glGetUniformLocation sp "tex")))
(glUseProgram sp)
(glUniform1i texloc 0))
(VAO_bind_and_draw_arrays vao GL_TRIANGLE_STRIP 0 4)
(glfwSwapBuffers window)
void))