# calculate effective light range

i wanna put a bounding sphere around my lights as im implementing an alogarithm to select the 8 closest in range lights to my meshes.

so ive got the OGL formula:
1.0f / (kc + kld + kqd2);

i’m using the default kc, kl, kq, but when i try to get them i get like invalid numbers:

``````
float kc, kl, kq;
glGetLightfv(0, GL_CONSTANT_ATTENUATION, &kc);
glGetLightfv(0, GL_LINEAR_ATTENUATION, &kl);
glGetLightfv(0, GL_QUADRATIC_ATTENUATION, &kq);

``````

just wondering what the defaults are.

then with all that, how do i calculate some point it which its not worth using the light to light a mesh?

im assuming something like this:
0.1f = 1.0f / (kc + kld + kqd2);

rearanging:
(kc + kld + kqd2) = 10

then i have to solve a quadratic, /me has done this since high school.

but then im gonna get 2 solutions. which to use (the largest)?

but mainly, i need to know what the defaults are?
kc = 0, kl = 1, kq = 0 ?

should i post in the advance section maybe :-/

GL_CONSTANT_ATTENUATION = 1.0

GL_LINEAR_ATTENUATION = 0.0

GL_QUADRATIC_ATTENUATION =0.0

It means no attenuation (no solution for 0.1f…)
Take the highest solution, as only positive params are allowed, it should be ok.