-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2010 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
#include "texenv.h"
#include "texture.h"
#include "texturing.h"
#include "texunit.h"
+using namespace std;
+
namespace Msp {
namespace GL {
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);
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