X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexenv.cpp;fp=source%2Ftexenv.cpp;h=6e5cca7748f2f6b25fa8194f15af2543a7caaf0e;hb=50e504e2171295d5922ddf87b358e0024db3ce40;hp=0000000000000000000000000000000000000000;hpb=dc1d1159a61f378bda11e5989ad694a86b9a3c77;p=libs%2Fgl.git diff --git a/source/texenv.cpp b/source/texenv.cpp new file mode 100644 index 00000000..6e5cca77 --- /dev/null +++ b/source/texenv.cpp @@ -0,0 +1,43 @@ +/* $Id$ + +This file is part of libmspgl +Copyright © 2008 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + +#include "texenv.h" +#include "texunit.h" + +namespace Msp { +namespace GL { + +TexEnv::TexEnv(): + mode(MODULATE) +{ } + +void TexEnv::set_mode(TexEnvMode m) +{ + mode=m; +} + +void TexEnv::set_color(const Color &c) +{ + color=c; +} + +void TexEnv::bind() +{ + if(TexUnit::current().set_texenv(this)) + { + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, mode); + glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &color.r); + } +} + +void TexEnv::unbind() +{ + TexUnit::current().set_texenv(0); +} + +} // namespace GL +} // namespace Msp