X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexturing.cpp;h=1c8410c57a6bff3ee9388805964a1cca0876981c;hb=1bad86b461abd4fe2a1cb1c6c5685adf5db13935;hp=425c710ca4d1357d2627995b02f0fc8040f21d86;hpb=f14435e58bfa0fa697a06ba9a454bb30cd37d9d8;p=libs%2Fgl.git diff --git a/source/texturing.cpp b/source/texturing.cpp index 425c710c..1c8410c5 100644 --- a/source/texturing.cpp +++ b/source/texturing.cpp @@ -3,6 +3,8 @@ #include "texturing.h" #include "texunit.h" +using namespace std; + namespace Msp { namespace GL { @@ -30,7 +32,7 @@ void Texturing::detach(unsigned attch) void Texturing::set_attachment(unsigned attch, const Texture *tex, const TexEnv *env) { if(attch>=TexUnit::get_n_units()) - throw InvalidParameterValue("Invalid texture attachment"); + throw out_of_range("Texturing::set_attachment"); if(attachments.size()<=attch) attachments.resize(attch+1); @@ -45,22 +47,20 @@ void Texturing::set_attachment(unsigned attch, const Texture *tex, const TexEnv void Texturing::bind_attachment(unsigned i) const { const Attachment &attch = attachments[i]; - TexUnit::activate(i); if(attch.tex) - attch.tex->bind(); + attch.tex->bind_to(i); else - Texture::unbind(); + Texture::unbind_from(i); if(attch.env) - attch.env->bind(); + attch.env->bind_to(i); else - TexEnv::unbind(); + TexEnv::unbind_from(i); } void Texturing::unbind_attachment(unsigned i) { - TexUnit::activate(i); - Texture::unbind(); - TexEnv::unbind(); + Texture::unbind_from(i); + TexEnv::unbind_from(i); } void Texturing::bind() const