Line rasterization

Line segment rasterization ignores last pixel. How to explicitly force OpenGL to draw this pixel?

Really? draw a point at the end or make your line one pixel longer.

One another thing: drawing accuracy for points and line segments are different -

code like this:

// all in orthographic projection

glBegin( GL_LINES );
glVertex3d( x0, y0, depth2 );
glVertex3d( x, y, depth2 );
glEnd();

glBegin( GL_POINTS );
glVertex3d( x, y, depth1 );
glEnd();

produces a line segment and a point that lies NEAR the segment’s end (positioning error is near float type precision limit)

Is it possible?

Problems left with OpenGL 1.1 libraries downloaded from M$. Funny though! Where’s the root of all evil? in Win2k OpenGL libraries, NVidia drivers (I have ASUS GF2MX400) or… somewhere else?

I will try it in a bit when I have time to see if I get the same…

I think it’s pixel center problems. The coordinate (x,y) may be projected exactly between two or four pixels, and lines and poins may round in different directions, therefore hitting different pixels when drawn.

Mine seemed ok using

glBegin( GL_LINES );
glVertex3d( 0, 0, 0 );
glVertex3d( 50, 50, 0 );
glEnd();

glBegin( GL_POINTS );
glVertex3d( 50, 50, 0);
glEnd();

with a perpixel ortho display set up.

But as Bob says try offsetting so that you are drawing from a pixel rather than the crossroads of 4 or whatever. There have been a few posts on this for 2d displays/raster coords

Nope, offsetting doesn’t cure this problem.

Yes, let’s blame Microsoft for everything. rolls eyes Actually, it’s no ones fault except the developers for trying to optimize their drivers; you’ll notice that the OpenGL specification does not require that all implementations have pixel-perfect results to the same rasterization call, so your line may appear differently on different setups.

GL dosen’t draw the bottom and left edges of polys so that if two polys share an edge only one of the polys will draw the shared pixels on the edge. same goes for lines left end as well.