View Full Version : Problem with GL_POINT_DISTANCE_ATTENUATION

08-13-2008, 04:19 AM
I have the following code:

float quadratic[] = { 1.0f, 0.01f, 0.0f };
glPointParameterfv( GL_POINT_DISTANCE_ATTENUATION, quadratic );
glPointParameterf( GL_POINT_FADE_THRESHOLD_SIZE, 60.0f );
glPointParameterf( GL_POINT_SIZE_MIN, 1.0f );
glPointParameterf( GL_POINT_SIZE_MAX, 15.0f );

glPointSize( 15.0f );

Whatever I go near or far the point doesn't seems to change the way I want... In any case it never reach 15.0f.... What Im doing wrong here? I am missing something?

Tks in advance!

08-14-2008, 01:22 AM
I manage to found the following obscure code:

float att[] = { 0.0f, 0.0f, 0.0f };

float H = 320;
double h = 2.0 / camera->mat_projection[5];
double D0 = sqrt(2.0)*H/h;
double k = 1.0/(1.0 + 2.0 * (1/camera->mat_projection[5])*(1/camera->mat_projection[5]));
att[1] = (float)(1.0/(D0*D0)*k);

glPointParameterfv( GL_POINT_DISTANCE_ATTENUATION, att );

But still the point sprite seems to grow when moving backward and shrink when moving forward... I tried to inverse the value but the result is even worst...

Any clue? someone? anyone?

ps: My Up vector is Z so the forward vector should be Y so att[1] right?