(bind-func VBO_create
(lambda (buf:i32* buflen)
(let ((vbo:VBO* (halloc))
(id:GLuint* (salloc)))
(glGenBuffers 1 id)
(gl_print_error "Error creating VBO")
(tfill! vbo
(pref id 0)
GL_INT
(* buflen 4) ;; sizeof(float)
(cast buf GLvoid*))
(glBindBuffer GL_ARRAY_BUFFER (VBO_id vbo))
(glBufferData GL_ARRAY_BUFFER (VBO_size vbo) (VBO_data vbo) GL_STREAM_DRAW)
(gl_print_error "Error setting VBO data")
(printf "Created ") (print vbo) (printf "\n")
vbo)))