X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexenv.cpp;fp=source%2Ftexenv.cpp;h=3730a7e188606e85bab9e501730665c33eb42cab;hb=abc16c5ab0fff0945d724febe9d5d3889fb8a6ce;hp=e6c06bcbbbcebbf2af37b25d9fe58ce02609e481;hpb=6a4907898281b738111e0c6527cc46f8810dc123;p=libs%2Fgl.git diff --git a/source/texenv.cpp b/source/texenv.cpp index e6c06bcb..3730a7e1 100644 --- a/source/texenv.cpp +++ b/source/texenv.cpp @@ -18,14 +18,18 @@ TexEnv::TexEnv(): void TexEnv::set_mode(TexEnvMode m) { mode = m; + if(current()==this) + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, mode); } void TexEnv::set_color(const Color &c) { color = c; + if(current()==this) + glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &color.r); } -void TexEnv::bind() +void TexEnv::bind() const { if(TexUnit::current().set_texenv(this)) { @@ -36,7 +40,12 @@ void TexEnv::bind() void TexEnv::unbind() { - TexUnit::current().set_texenv(0); + if(TexUnit::current().set_texenv(0)) + { + Color black(0, 0, 0, 0); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, MODULATE); + glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &black.r); + } } } // namespace GL