How can I apply antialiasing to my line() function using Pitteway and

Watkinson algorithm without using the predefined GL_SMOOTH?

Thnx

How can I apply antialiasing to my line() function using Pitteway and

Watkinson algorithm without using the predefined GL_SMOOTH?

Thnx

> How can I apply antialiasing to my line() function using Pitteway and

> Watkinson algorithm without using the predefined GL_SMOOTH?

OpenGL rather than GLUT.

In case you're not happy with the OpenGL line antialiasing, you can use

glHint with GL_LINE_SMOOTH_HINT in order to set a preference (speed vs

quality) for antialiased lines. However, hints are optional and in many

OpenGL implementations they won't make a difference on the results you

get.

The algorithm used by OpenGL to antialias lines is described at section

3.4.2 "Other Line Segment Features" of the OpenGL 1.3 Specification

(downloadable from http://www.opengl.org )

In case the algorithm used by OpenGL doesn't meet your needs, it's

likely that you'll have to handcode your rasterization algorithm in C,

render in a memory buffer and then copy the buffer to the window. This

is slow, and should only be used if you're really interested in the deep

details of antialiasing. For most situations, the OpenGL antialiased

lines are nice enough.

Csar

I do have the following line() function which consists of Bresenhams'

Algorithm. Now I would like to apply antialiasing using Pitteway and

Watkinson Algorithm which is a modification of Bresenhams' Alg. Does anyone

have a clue on how to achieve such effect. I have looked up on the web for

some samples but had no luck.

void line(int x1, int y1, int x2, int y2) {

glColor3f(0.0,0.0,0.0); //Set Line Color To Black;

glPointSize(10.0); //Set Pixel Size For This Line;

glBegin(GL_LINES);

//Bresenhams' Algorithm;

int dx=x2-x1; //Delta X Evaluation;

int dy=y2-y1; //Delta Y Evaluation;

int init=2 * dy-dx; //Initialisation;

int moveS=2*dy; //MoveS - Straight Move (E<0);

int moveD=2 * dy-2 * dx; //MoveD - Diagonal Move (E>0);

int x,y,endPixel;

if (x2 > x1) {

x = x1;

y = y1;

endPixel = x2;

}

else {

x = x2;

y = y2;

endPixel = x1;

}

glVertex2i(x,y);

//setPixel(x,y);

while (x < endPixel) {

x++;

if (init < 0)

init += moveS;

else {

y++;

init += moveD;

}

}

glVertex2i(x,y);

//setPixel(x,y);

glEnd();

glFlush();

2. custom runtime rotation expressions on instanced particle geometry?

3. Threading GLUT (or combining GLUT & CORBA)

4. Smooth shaded triangles in povray

5. Q: pthreads && glut/opengl on SGI

7. TIFF antialiasing without antialiasing?

8. Altamira Composer SE - Problem with colours

9. Full Scene Antialiasing [LONG] (was Re: Antialiasing fonts)

10. Antialiasing Bresenham (Pitteway & Watkinson)

12. Antialiasing & SVGA palette problem

13. E&S antialiasing

2 post • Page:**1** of **1**