View Full Version : Effect of Light on the size of the object

12-19-2000, 07:17 AM
I have drawn a cylinder which axis is along the z axis. I have lighting problem when I increase the length of cylinder. When it is small, top and inside surfaces are bright. When I increase the length of cylinder it is getting darker. What could be the problem. How can I avoid this?

Any ideas?

I used following lighting propertices
GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat light_position[] = { 1.0, 1.0, 1.0, 1.0 };

glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);


[This message has been edited by Ramesh (edited 12-19-2000).]

12-19-2000, 07:30 AM
If you are dealing with source lights, i.e. non directional lights, then I think you must increase the slices and stacks of the cylinder.

12-19-2000, 07:34 AM
I do not want to disturb the properties of the object. Is it possible to control the light spreading area or something else (I am not sure), so that entire object will be enough bright to see...


12-19-2000, 10:51 AM

Plug this into your GL initialization routine and see if it fixes the situation:

If it fixes your problems, great! If you need to know what that command does, email me and I'll explain.

If not, sorry, must be something other than the normal vector length that's disturbing your lighting intensities.


12-19-2000, 03:38 PM
If you are using attenuation with your lights, the cylinder would get darker as the vertices at the ends get farther away from the light. Increasing the number of stacks and slices in the cylinder would help.