- const RenderPass *old=current;
- current=this;
-
- if(shprog)
- {
- shprog->bind();
- shdata->apply();
- }
- else if(old && !old->shprog)
- GL::Program::unbind();
-
- if(material)
- material->bind();
- else if(old && !old->material)
- GL::Material::unbind();
-
- for(unsigned i=0; i<textures.size(); ++i)
- if(textures[i].texture)
- textures[i].texture->bind_to(i);
- if(old)
- {
- for(unsigned i=textures.size(); i<old->textures.size(); ++i)
- GL::Texture::unbind_from(i);
- }