PDA

View Full Version : Light in openGL



alexiis
11-27-2011, 06:25 AM
Hello, dear community!
I have 3D object. At the moment i have 1 light source - because of this when i rotate coordinate system around my object i see that object`s point colors changed because of angle to my light source. All i wanna do is to make light source that will light my object same from all points - so even if i rotate coordinate system - i shouldnt see that object`s point colors are changed - they must be always the same. Thank you.

biller23
11-27-2011, 08:23 AM
With the fixed-functions pipeline, simply disable the lights.
With shaders, simply use your diffuse color (from vertex or texture) directly as output of the fragment shader.

alexiis
11-27-2011, 03:38 PM
If i disable the light, my object texture become black.

For lighting i used :

position : Array [0..3] of GLFloat = (0.0, 0.0, 3.5, 1.0);
begin
glLightfv (GL_LIGHT0, GL_SPECULAR , @position);
glEnable (GL_LIGHTING);
glEnable(GL_LIGHT0);

biller23
11-27-2011, 04:22 PM
Have you tried to set the vertex color calling glColor()? The vertex color needs to be different than the default black, becouse it will be multiplied with the texture color.