PDA

View Full Version : Line stippling not working



ZeoG
03-27-2002, 03:21 AM
Hi,
I have the following code demoonstrating antialiasing and stippling:

glLoadIdentity();
glTranslatef(-2.5, 5.0, 0.0);
glColor3f(1.0, 1.0, 0.0);
glDisable(GL_POINT_SMOOTH);
glPointSize(10.0);
glBegin(GL_POINTS);
glVertex2f(-1.0, 1.0);
glVertex2f(2.0, 2.0);
glVertex2f(0.0, 0.0);
glVertex2f(1.0, -1.0);
glVertex2f(-2.0, -2.0);
glEnd();

glLoadIdentity();
glTranslatef(2.5, 5.0, 0.0);
glColor3f(1.0, 0.75, 0.0);
glEnable(GL_POINT_SMOOTH);
glBegin(GL_POINTS);
glVertex2f(-1.0, 1.0);
glVertex2f(2.0, 2.0);
glVertex2f(0.0, 0.0);
glVertex2f(1.0, -1.0);
glVertex2f(-2.0, -2.0);
glEnd();

glLoadIdentity();
glTranslatef(-2.5, 0.0, 0.0);

glColor3f(1.0, 1.0, 0.0);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_LINE_STIPPLE);
glLineWidth(10.0);
glBegin(GL_LINE_STRIP);
glVertex2f(-1.0, 1.0);
glVertex2f(2.0, 2.0);
glVertex2f(0.0, 0.0);
glVertex2f(1.0, -1.0);
glVertex2f(-2.0, -2.0);
glEnd();

glLoadIdentity();
glTranslatef(2.5, 0.0, 0.0);
glColor3f(1.0, 0.75, 0.0);
glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINE_STRIP);
glVertex2f(-1.0, 1.0);
glVertex2f(2.0, 2.0);
glVertex2f(0.0, 0.0);
glVertex2f(1.0, -1.0);
glVertex2f(-2.0, -2.0);
glEnd();

glLoadIdentity();
glTranslatef(-2.5, -5.0, 0.0);
glColor3f(0.0, 1.0, 0.0);
glLineWidth(1.0);
glEnable(GL_LINE_STIPPLE);
glLineStipple(2, 0x3F07);
glBegin(GL_LINE_STRIP);
glVertex2f(-1.0, 1.0);
glVertex2f(2.0, 2.0);
glVertex2f(0.0, 0.0);
glVertex2f(1.0, -1.0);
glVertex2f(-2.0, -2.0);
glEnd();

glLoadIdentity();
glTranslatef(2.5, -5.0, 0.0);
glLineStipple(2, 0x0C0F);
glBegin(GL_LINE_STRIP);
glVertex2f(-1.0, 1.0);
glVertex2f(2.0, 2.0);
glVertex2f(0.0, 0.0);
glVertex2f(1.0, -1.0);
glVertex2f(-2.0, -2.0);
glEnd();

I set up an otho-screen and everything is drawn, but some things are just not working:

GL_POINT_SMOOTH has no effect at all - thy look exactly the same

GL_LINE_SMOOTH lookes weired, somewhat like blended, but blending is turned off.

the last lines are not stippled at all either, stippling is not working

I desperately tried everything, turning line_smoothing on and off.

Does anyone know how to get those lines stippeled, or had the same problem?

(Win98,ATI Rage 128 Pro,MSVC++)

Thanks,
Zeog

mikael_aronsson
03-27-2002, 04:44 AM
Hi !

You don't have the hint flags set to fast or something like that maybe ?

Mikael

ZeoG
03-28-2002, 08:00 AM
I turned GL_POINT_SMOOTH_HINT as well as GL_LINE_SMOOTH_HINT to GL_NICEST (and PERSPECTIVE_CORRECTION) but those huge Points look still the same as the aliased ones and the smoothed Line has still a stipe pattern and looks like blended.
And it doesn't help me with my stippling not being done.
But thanks.

dorbie
03-28-2002, 08:51 PM
Does it work when you turn off antialiasing?

zed
03-29-2002, 12:08 AM
did u turn on blending with src_alpha,1-src_alpha
check the faq for details

ZeoG
03-29-2002, 01:31 AM
No, blending is entirely turned off.
But I spend some time to download drivers and now i get a rather stippled line.
But the antialiased line is now only 1 pixel wide, and those points are still squares.

Bob
03-29-2002, 02:43 AM
Blending is required to make anti-aliasing work. A blend equation of GL_SRC_ALPHA & GL_ONE_MINUS_SRC_ALPHA usually works.