PDA

View Full Version : Overlapping lines and blending



steve_j
03-26-2008, 05:08 PM
Hi!

How can I achieve that parts of overlapping lines don't become brighter? I am using antialised lines with blendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA).

Thanks,
steve

-NiCo-
03-27-2008, 01:48 AM
That's weird, this code seems to work just fine:



glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glClearColor(0.0,0.0,0.0,0.0);
glClear(GL_COLOR_BUFFER_BIT);

glColor3f(0.5f,0.5f,0.5f);

glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

glLineWidth(10.0);

glBegin(GL_LINES);
glVertex2f(-0.5, 0.2);
glVertex2f( 0.5,-0.2);
glVertex2f(-0.2,-0.5);
glVertex2f( 0.2, 0.5);
glEnd();

glLineWidth(1.0);

glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);