;; matrix should be float* 5x5
(bind-func shader_set_grid_offsets
(lambda (matrix:float* width:float height:float factor:float)
(let ((xinc:float (/ factor width))
(yinc:float (/ factor height))
(i 0) (j 0))
(dotimes (i 5) ;; columns
(dotimes (j 5) ;; rows
(pset! matrix (+ (* (+ (* i 5) j) 2) 0)
(+ (* -2.0 xinc)
(* (i32tof i) xinc)))
(pset! matrix (+ (* (+ (* i 5) j) 2) 1)
(+ (* -2.0 xinc)
(* (i32tof i) yinc)))))
void)))