]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texenv.cpp
Unbind things if they are deleted while current
[libs/gl.git] / source / texenv.cpp
index 51adf9fb4aee45f1aa40e93effbad084e3c3b4d4..c8af55f85febad1b22c5560efb0c7f688fca405e 100644 (file)
@@ -9,6 +9,15 @@ TexEnv::TexEnv():
        color(0, 0, 0, 0)
 { }
 
+TexEnv::~TexEnv()
+{
+       if(this!=&default_object())
+       {
+               while(TexUnit *unit = TexUnit::find_unit(this))
+                       unbind_from(unit->get_index());
+       }
+}
+
 const TexEnv &TexEnv::default_object()
 {
        static TexEnv obj;