This extension is driving me crazy…
I attempt to draw some stars with points. I want the stars to light off when moving away (just like in startrek or in the stars screensavers).
Without multisample, I can not use the Fade-Threshold. So, I activated it (I added “GLX_SAMPLE_BUFFERS, 1” to my attribList in my call to glXChooseVisual).
I check (with glGetIntergerv) that I have a GLX_SAMPLE_BUFFERS of 1. While checking for GLX_SAMPLES it returns 2. So, I suppose the multisample is ok.
Now, there is my code:
#ifdef __WITH_MULTISAMPLE
// Enabling the multisample
glEnable (GL_MULTISAMPLE);
#endif // __WITH_MULTISAMPLE
// Enabling a standard blending for alpha
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Please make me beautiful round points
glHint (GL_POINT_SMOOTH_HINT, GL_NICEST);
glEnable (GL_POINT_SMOOTH);
// Configuring the point_parameters extension
GLfloat att[3]={0.f,0.f,1.f};
glPointParameterf (GL_POINT_SIZE_MIN, 1.f);
glPointParameterf (GL_POINT_SIZE_MAX, 100.f);
#ifdef __WITH_MULTISAMPLE
glPointParameterf (GL_POINT_FADE_THRESHOLD_SIZE, 4.f);
#endif // __WITH_MULTISAMPLE
glPointParameterfv (GL_POINT_DISTANCE_ATTENUATION, att);
// Drawing my points
glPointSize (2.f);
glBegin (GL_POINTS);
for (...)
{
glVertex3f (...);
}
glEnd ();
My problem is that with or without the multisample, this code does exactly the same thing. When moving away, all the points go in the center of the screen, and I have a white heap of stars.
What’s wrong?