(bind-func shader_update_projection_texture
(lambda (shader:ShaderProgram* textureUnit texture:Texture*)
(if (or (null? texture)
(< (id texture) 1))
(begin
(glUniform1i (glGetUniformLocation (id shader) "isProjectionTextured") 0)
(glUniform1i (glGetUniformLocation (id shader) "projectionTexture") textureUnit)
(glUniform1f (glGetUniformLocation (id shader) "projectionTextureWeight") PROJECTION_TEXTURE_WEIGHT))
(begin
(bind texture textureUnit)
(glUniform1f (glGetUniformLocation (id shader) "projectionTextureWeight") PROJECTION_TEXTURE_WEIGHT)
(glUniform1i (glGetUniformLocation (id shader) "isProjectionTextured") 1)
(glUniform1i (glGetUniformLocation (id shader) "projectionTexture") textureUnit)))
(gl_print_error "Error setting up projection texture")
void))