10 Texturing::~Texturing()
16 void Texturing::attach(unsigned attch, const Texture &tex)
18 set_attachment(attch, &tex);
21 void Texturing::detach(unsigned attch)
23 set_attachment(attch, 0);
26 void Texturing::set_attachment(unsigned attch, const Texture *tex)
28 if(attch>=TexUnit::get_n_units())
29 throw out_of_range("Texturing::set_attachment");
31 if(attachments.size()<=attch)
32 attachments.resize(attch+1);
34 attachments[attch] = tex;
37 bind_attachment(attch);
40 void Texturing::bind_attachment(unsigned i) const
42 if(const Texture *tex = attachments[i])
45 Texture::unbind_from(i);
48 void Texturing::unbind_attachment(unsigned i)
50 Texture::unbind_from(i);
53 void Texturing::bind() const
55 const Texturing *old = current();
58 for(unsigned i=0; i<attachments.size(); ++i)
62 for(unsigned i=attachments.size(); i<old->attachments.size(); ++i)
68 void Texturing::unbind()
70 const Texturing *old = current();
73 for(unsigned i=old->attachments.size(); i--;)