X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Ftexturing.cpp;h=77bb15435c7391a62a0298ea653f6699417eb55f;hb=HEAD;hp=093c602e917c2ec7bf3ee67a626eedb4f4e43ab4;hpb=c8f98daaaba04ba93d6d7170302d8b91c3410fa5;p=libs%2Fgl.git diff --git a/source/texturing.cpp b/source/texturing.cpp deleted file mode 100644 index 093c602e..00000000 --- a/source/texturing.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include "texture.h" -#include "texturing.h" -#include "texunit.h" - -using namespace std; - -namespace Msp { -namespace GL { - -Texturing::~Texturing() -{ - if(current()==this) - unbind(); -} - -void Texturing::attach(unsigned attch, const Texture &tex) -{ - set_attachment(attch, &tex); -} - -void Texturing::detach(unsigned attch) -{ - set_attachment(attch, 0); -} - -void Texturing::set_attachment(unsigned attch, const Texture *tex) -{ - if(attch>=TexUnit::get_n_units()) - throw out_of_range("Texturing::set_attachment"); - - if(attachments.size()<=attch) - attachments.resize(attch+1); - - attachments[attch] = tex; - - if(current()==this) - bind_attachment(attch); -} - -void Texturing::bind_attachment(unsigned i) const -{ - if(const Texture *tex = attachments[i]) - tex->bind_to(i); - else - Texture::unbind_from(i); -} - -void Texturing::unbind_attachment(unsigned i) -{ - Texture::unbind_from(i); -} - -void Texturing::bind() const -{ - const Texturing *old = current(); - if(set_current(this)) - { - for(unsigned i=0; iattachments.size(); ++i) - unbind_attachment(i); - } - } -} - -void Texturing::unbind() -{ - const Texturing *old = current(); - if(set_current(0)) - { - for(unsigned i=old->attachments.size(); i--;) - unbind_attachment(i); - } -} - -} // namespace GL -} // namespace Msp;