PDA

View Full Version : How to control lighting effects on objects?



simProG
09-19-2009, 12:23 PM
This is my first time posting on this forums.
I have a questions regarding lighting effects.
I have placed a light source and have also drawn two objects. (i.e. a sphere and a cube).
Let's say I want the sphere to be lit by the light source as per normal but the cube should be unaffected by the light source and be lit uniformly as when there is no light source.
Any idea how I should go about doing it? Any help greatly appreciated.

Dark Photon
09-19-2009, 06:49 PM
This is my first time posting on this forums.
I have a questions regarding lighting effects.
I have placed a light source and have also drawn two objects. (i.e. a sphere and a cube).
Let's say I want the sphere to be lit by the light source as per normal but the cube should be unaffected by the light source and be lit uniformly as when there is no light source.
Any idea how I should go about doing it? Any help greatly appreciated.
When you render the sphere, set the light's SPECULAR and/or DIFFUSE to something non-zero. When you render the CUBE, set both the light's SPECULAR and DIFFUSE to 0, and just set AMBIENT to non-0.

simProG
09-20-2009, 01:41 AM
That worked! Thanks lots.

msqrt
09-20-2009, 02:02 AM
Why not just call glDisable and glEnable for lighting before and after drawing the cube?