Sign in to follow this  
Uthman

more light problems

Recommended Posts

i have a rather large scene, 500x500x500 units that i am trying to light up; im guessing the scene is just too large because i only meakly see ambient lighting. could this be because of the attenuation, and if so how would i go about fixing it? im pretty much following nehe's code and ive tried setting all 3 atten.'s to 0 without any avail.
   glLightfv(GL_LIGHT1, GL_AMBIENT, cenlight.a.m); glLightfv(GL_LIGHT2, GL_AMBIENT, camlight.a.m);
   glLightfv(GL_LIGHT1, GL_DIFFUSE, cenlight.d.m);	glLightfv(GL_LIGHT2, GL_DIFFUSE, camlight.d.m);
   glLightfv(GL_LIGHT1, GL_POSITION,cenlight.p.m); glLightfv(GL_LIGHT2, GL_POSITION,camlight.p.m);
   glEnable(GL_LIGHT1);
   glEnable(GL_LIGHT2);

   glLightf(GL_LIGHT1, GL_CONSTANT_ATTENUATION, 0);
   glLightf(GL_LIGHT1, GL_LINEAR_ATTENUATION, 0);
   glLightf(GL_LIGHT1, GL_QUADRATIC_ATTENUATION, 0);
   glLightf(GL_LIGHT2, GL_CONSTANT_ATTENUATION, 0);
   glLightf(GL_LIGHT2, GL_LINEAR_ATTENUATION, 0);
   glLightf(GL_LIGHT2, GL_QUADRATIC_ATTENUATION, 0);

   glEnable(GL_LIGHTING);

and my scene is just about black.

Share this post


Link to post
Share on other sites
try first with a diretional light eg glLightfv(GL_LIGHT1, GL_POSITION, VEC4(1,1,0,0) );
do u see something?

if so try setting other values than 0 for the attenuation

btw theres also a global ambient function

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this