When to use ofEnableLighting()/ofDisableLighting()?


#1

Hi, I always thought I have to call ofEnableLighting()/ofDisableLighting() and ofLight::enable()/ofLight::disable() together to make the lighting properly work like the following way. I think I read somewhere that this is the proper way to use lighting in OF.

ofEnableLighting();
light.enable();
 ofDrawSphere(ofGetWidth()/2, ofGetHeight()/2, 100);
 light.disable();
ofDisableLighting();

But I just found out that it seems like it’s works fine even without calling ofEnableLighting(); and ofDisableLighting();.

And even if I disable lighting using ofDisableLighting();, I could make it enabled again by calling light.enable();

So I wonder why we have ofEnableLighting()/ofDisableLighting() separately and when to use these instead of ofLight::enable()/ofLight::disable().

Thanks in advance.

EDIT: I think the lighting is not completely disabled just by calling ofLight::disable(). When I draw other objects outside lighting area, they also got affected by the lighting. So I guess I have my answer.