Hello,
I am trying to draw a cloud of points, however I am having some problems when I enable blending.
Here is the relevant code:
glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT);
glDisable(GL_LIGHTING);
glEnable(GL_BLEND);
glEnable(GL_POINT_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
gluPerspective(fovAngle/2.0,aspect,nearPlane,farPlane);
glMatrixMode(GL_MODELVIEW);
gluLookAt(origin[0],origin[1],origin[2],
target[0],target[1],target[2],
upDirection[0],upDirection[1],upDirection[2]);
const Point3D *p;
glPointSize(size);
glBegin(GL_POINTS);
glColor4f(r,g,b,a);
for(unsigned int ui=0; ui<pts.size(); ui++)
{
p=&(pts[ui]);
glVertex3f((*p)[0],(*p)[1],(*p)[2]);
}
glEnd();
}
This results in the following images.
Left:
Centre:
Right:
Note there is a sphere drawn in using gluSphere to show that lighting is actually disabled (see how it appears up as a circle).
If I remove glEnable(GL_BLEND), then the points have the correct apparent intensity (ie, all have the same intensity, independant of viewing angle). This is good, but the points are blocky, which is what I was trying to solve in the first place.
What is going on? I cannot see where any lighting calculations can come into play if I have disabled lighting completely. I don’t know what effect can be causing this view angle dependency!
Any help is greatly appreciated