9 Texturing::~Texturing()
15 void Texturing::attach(unsigned attch, const Texture &tex)
17 set_attachment(attch, &tex, 0);
20 void Texturing::attach(unsigned attch, const Texture &tex, const TexEnv &env)
22 set_attachment(attch, &tex, &env);
25 void Texturing::detach(unsigned attch)
27 set_attachment(attch, 0, 0);
30 void Texturing::set_attachment(unsigned attch, const Texture *tex, const TexEnv *env)
32 if(attch>=TexUnit::get_n_units())
33 throw InvalidParameterValue("Invalid texture attachment");
35 if(attachments.size()<=attch)
36 attachments.resize(attch+1);
38 attachments[attch].tex = tex;
39 attachments[attch].env = env;
42 bind_attachment(attch);
45 void Texturing::bind_attachment(unsigned i) const
47 const Attachment &attch = attachments[i];
59 void Texturing::unbind_attachment(unsigned i)
66 void Texturing::bind() const
68 const Texturing *old = current();
71 for(unsigned i=0; i<attachments.size(); ++i)
75 for(unsigned i=attachments.size(); i<old->attachments.size(); ++i)
81 void Texturing::unbind()
83 const Texturing *old = current();
86 for(unsigned i=old->attachments.size(); i--;)
92 Texturing::Attachment::Attachment():