;; id of 0 means Create new texture
;; id > 0 means load image into existing texture
;; returns texture
(bind-func gl_load_image_rect
(lambda (path id)
(let ((texid (SOIL_load_OGL_texture path SOIL_LOAD_AUTO id (+ SOIL_FLAG_MIPMAPS SOIL_FLAG_INVERT_Y SOIL_FLAG_TEXTURE_RECTANGLE))))
(if (= texid 0)
(printf "Error loading: %s\n" path))
texid)))