(bind-func bind_cube
(lambda (tex:Texture* active:i32)
;; (println "start bind cube")
(glActiveTexture (+ GL_TEXTURE0 active))
(glBindTexture GL_TEXTURE_CUBE_MAP (id tex))
(gl_print_error "error binding texture cube data")
(cond ((or (= (type tex) GL_RGBA)
(= (type tex) GL_BGRA))
(begin
;; set some parameters
(glTexParameteri GL_TEXTURE_CUBE_MAP GL_TEXTURE_WRAP_S GL_CLAMP_TO_EDGE)
(glTexParameteri GL_TEXTURE_CUBE_MAP GL_TEXTURE_WRAP_T GL_CLAMP_TO_EDGE)
(glTexParameteri GL_TEXTURE_CUBE_MAP GL_TEXTURE_WRAP_R GL_CLAMP_TO_EDGE)
(glTexParameteri GL_TEXTURE_CUBE_MAP GL_TEXTURE_MIN_FILTER GL_LINEAR)
(glTexParameteri GL_TEXTURE_CUBE_MAP GL_TEXTURE_MAG_FILTER GL_LINEAR)
1))
(else;; do nothing
1))
(gl_print_error "error setting tex cube parameters")
(id tex)))