Hi All,
Is there a way to avoid this ugly effect of thick lines?
The red arrow points to an arc drawn with: glLineWidth(8);
I have also tryed activating line antialiasing but nothing changes.
Thanks in advance,
Alberto
Hi All,
Is there a way to avoid this ugly effect of thick lines?
The red arrow points to an arc drawn with: glLineWidth(8);
I have also tryed activating line antialiasing but nothing changes.
Thanks in advance,
Alberto
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glLineWidth(8);
//draw lines
Cheers,
N.
LineWidth prolly aint gonna give the best results but it certainly shouldnt be that bad, it looks like youre missing parts try GL_LINE_LOOP or GL_LINE_STRIP (i think thats the syntax) instead of GL_LINES
if that doesnt work for better lines u need to do the AA yourself eg in a fragment program or use textured quads for the lines
Hi Guys,
We don’t wanted to activate antialiasing, because it would reduce overall performances.
BTW we are already using GL_LINE_STRIP.
Looks like the only solution is activating antialiasing.
Thanks,
Alberto
What’s wrong with the solution I provided:
glClearColor(1.0,1.0,1.0,0.0);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
unsigned int subdiv = 256;
float radius = 0.5f;
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glColor3f(0.0f,0.0f,0.0f);
glLineWidth(8.0f);
glBegin(GL_LINE_LOOP);
for (unsigned int i=0;i<subdiv;++i)
glVertex2f(radius*cos(2*M_PI*i/subdiv),radius*sin(2*M_PI*i/subdiv));
glEnd();
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
This works like a charm without a multisample buffer.
Cheers,
N.