(bind-func xtm_skybox_fx
(lambda (fbo:FBO* model:float* view:float* projection:float*)
(let ((shader xtm_render_skybox_shader)
(camera_pos:float* (tref (xtm_get_camera) 0)))
;; (glDepthMask GL_FALSE)
(bind fbo)
(start shader)
(fill_identity_matrix model)
(fill_pos_scale_matrix model
(pref camera_pos 0) (pref camera_pos 1) (pref camera_pos 2) ;; position
SKY_BOX_SCALE SKY_BOX_SCALE SKY_BOX_SCALE) ;; scale
(shader_update_matrices shader model view projection)
(bind_cube SKY_BOX_TEXTURE 0) ;; update off (sky never changes!)
(glUniform1i (glGetUniformLocation (id shader) "tex1") 0)
(xtm_draw_model SKY_BOX_MODEL shader model view projection)
(unbind_cube SKY_BOX_TEXTURE 0)
(stop shader)
(unbind fbo)
;; (glDepthMask GL_TRUE)
void)))