(bind-func bind
(lambda (tex:Texture* unit:i32)
(glActiveTexture (+ GL_TEXTURE0 unit))
(glBindTexture GL_TEXTURE_2D (id tex))
(cond ((or (= (type tex) GL_RGBA)
(= (type tex) GL_RGB)
(= (type tex) GL_BGR)
(= (type tex) GL_BGRA))
(begin
;; set some parameters
(glTexParameteri GL_TEXTURE_2D GL_TEXTURE_WRAP_S GL_CLAMP_TO_EDGE)
(glTexParameteri GL_TEXTURE_2D GL_TEXTURE_WRAP_T GL_CLAMP_TO_EDGE)
(glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER GL_LINEAR)
(glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MAG_FILTER GL_LINEAR)
1))
((= (type tex) GL_DEPTH_COMPONENT)
(begin
(glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MAG_FILTER GL_NEAREST)
(glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER GL_NEAREST)
(glTexParameteri GL_TEXTURE_2D GL_TEXTURE_WRAP_S GL_CLAMP_TO_EDGE)
(glTexParameteri GL_TEXTURE_2D GL_TEXTURE_WRAP_T GL_CLAMP_TO_EDGE)
1))
(else;; do nothing
1))
(gl_print_error "error setting tex parameters")
(id tex)))