X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flighting.cpp;h=ce522ac06a11e77151a5c7fbe0967347674f2aa3;hb=6dc2da27f0831d4172fcfeba4900616fd6c844b8;hp=5cda4f4c6a4e005a5ad71c22427ddc0c5d0d69c7;hpb=bbd21944fae06f134625b2f5595c3aab36c3aa9e;p=libs%2Fgl.git diff --git a/source/lighting.cpp b/source/lighting.cpp index 5cda4f4c..ce522ac0 100644 --- a/source/lighting.cpp +++ b/source/lighting.cpp @@ -104,14 +104,25 @@ void Lighting::bind() const if(lights.size()>LightUnit::get_n_units()) throw invalid_operation("Lighting::bind"); + const Lighting *old = current(); if(!set_current(this)) return; enable(GL_LIGHTING); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, &ambient.r); for(unsigned i=0; ibind_to(i); + else + Light::unbind_from(i); + } + + if(old) + { + for(unsigned i=lights.size(); ilights.size(); ++i) + Light::unbind_from(i); + } if(fog_density) {