Background, mesh lighting

so I have this problem: if I enable (directional) lighting in draw(), the background color is completely dim, like everything else that is drawn before m_light.enable(). I thought light affected just the objects between ofLight begin() and end().

ofBackgroundGradient(ofColor::darkGoldenRod, ofColor::darkGrey);


ofTranslate( ofGetWidth()/2, ofGetHeight()/2, 0 );
ofSphere(0,0,0, 200);


I am using the trunk, but this happens also with 0.8.4. Is there any way to draw the background without having it affected by the scene lighting?

can you add ofDisableLighting() after disabling the light?

awesome, it worked!

when the first light is enabled it also enables the global lighting which makes all the objects to be rendered calculating lighting. the last light should probably disable lighting if it wasn’t enable at the beginning but this would complicate the internals of ofLight a bit and it’s probably not worth since the programmable renderer doesn’t have this problem anymore

Ok. got it. can I ask you something more project related? I know that probably this mesh doesn’t make really sense, lights-wise, the bottom faces should be a bit darker considering a light coming from a bit above the camera, and looking at the object.

But I am having a real hard time with directional lights to achieve this kind of almost flat shading. Do you think it’s possible with stock OpenGL lighting?

Moreover, and this is more general: I never know what is the best way to go to get a color for a material. Is it ok to have white light and and set the material specular color to blue? If I don’t want reflections too? The subject is a bit tricky

the diffuse color is what defines the color of a material, the specular is only for the “reflections” that you get where the light hits the object more directly and really few real materials have anything than white. the light is also usually white unless you really want to have a light of a different color.