Color problem with Antialiased lines on linux

Hi !

I work with both linux and windows and I’ve found something weird about Antialiased lines.

I set a color, draw a simple antialiased line and I figured out that the color of this line is slightly different from what it should have been.
I have the exact color with windows.

My graphics card is a quadro 4 and I use the nvidia drivers on linux.

Here’s an example with 2 lines ( one antialiased and one not ).

Generated on linux :

And on windows :

You can see if you compare the colors with any paint-like that both lines have the same color on windows but not on linux.

Is it a bug from the nvidia openGL implementation ?
Has anyone hear about that before ?

[This message has been edited by sandyT (edited 08-07-2003).]

[This message has been edited by sandyT (edited 08-07-2003).]

[This message has been edited by sandyT (edited 08-07-2003).]

Have you enabled full-scene antialiasing in either windows or linux ?
What are the driver versions installed in windows and linux ?
Do the windows and linux programs run on the same hardware ?

And btw, please correct the links. I can’t see any of them and it doesn’t help alot

[edit: ooops in fact I can see the pictures if I download them. I just can’t display them in my browser].

well, it might be a driver issue. At least, a precision issue.
Do you have, for instance, a 32bit desktop on windows and 16bit desktop on linux ?

[This message has been edited by vincoof (edited 08-08-2003).]

well, if you look at your lines, the ones at the rights are not the same for Linux and Windows… Is this normal ?

If you mean the orientation of the ending points of the segment, then yes it’s normal.
When anti-aliased, those ending points are cut orthogonal to the line direction, when not anti-aliased, those ending points are cut to a view-aligned direction i.e. horizontal or vertical only. In that case, if the line width is greater than the line height, the edge is cut vertical otherwise it is cut horizontal.
That’s how OpenGL specifies the line rasterization.
Though, in the very special case where the line is diagonal, floating-point precision issues may either the cut the ending points horizontally or vertically, you never really know. That’s exactly what happens here.

SandyT:

well, maybe the linux nvidia driver interpolation color function is slightly different that under W32 ? (this should never be right, isn’t it ?).

Another thing that came in my mind as we discuss it in another topic is that you may not have the same color depth precision in W32 and in Linux. Do you ?

Originally posted by vincoof:
If you mean the orientation of the ending points of the segment, then yes it’s normal.
When anti-aliased, those ending points are cut orthogonal to the line direction, when not anti-aliased, those ending points are cut to a view-aligned direction i.e. horizontal or vertical only. In that case, if the line width is greater than the line height, the edge is cut vertical otherwise it is cut horizontal.
That’s how OpenGL specifies the line rasterization.
Though, in the very special case where the line is diagonal, floating-point precision issues may either the cut the ending points horizontally or vertically, you never really know. That’s exactly what happens here.

So, if you draw another line at the up-right of the right one and ajust it to join correctly under Linux, this won’t be the case under W32 ?? This seems very quiete bad !!

So, if you draw multi-lines segments anti-aliased under a specific OS that all join the previous (ie. just by defining new segment points using vectors), the result will not be the same in another one ?? I cannot understand why this is like that. I may be dumb or fool or whatever, but for me, it would be normal to know how your segment will be drawn (how a diagonal wide segment will be drawn at its extremities: if it will be horizontal or vertical): it seems a minimum if you want to draw other lines joining the previous one.

I hope you could understand what I’d like to tell.

Originally posted by jide:
So, if you draw another line at the up-right of the right one and ajust it to join correctly under Linux, this won’t be the case under W32 ??

We can’t say that it will not be the case, it rather may not be the case.
And it happens when running the application in different OS (linux/windows) but it may also happen when running the application with different hardware (NV/ATI) or even with different driver version !

Originally posted by jide:
This seems very quiete bad !!

Yes it is, and that’s why the LINE_SMOOTH option has been invented for. Note that this will be noticed only for very wide lines. Generally, if line width is inferior to 3, it is rarely noticeable, which is fortunately the case in most applications.

Originally posted by jide:
So, if you draw multi-lines segments anti-aliased under a specific OS that all join the previous (ie. just by defining new segment points using vectors), the result will not be the same in another one ??

That’s wrong. With anti-aliasing enabled, il will look the same in any case, no matte r the OS or the hardware or whatever.
The worst case scenario is a sub-pixel sampling error, which will be absolutely not noticeable to the human eye.

Originally posted by jide:
for me, it would be normal to know how your segment will be drawn (how a diagonal wide segment will be drawn at its extremities: if it will be horizontal or vertical): it seems a minimum if you want to draw other lines joining the previous one.

You know it … in almost all cases.
The problem exclusively happens in the very special case where the lines are projected as diagonal lines of 45 degrees or 135 degrees over the screen.
And as I said above, if you really want to control that precision issue, just use anti-aliased lines and you’re no longer in doubt.

thanx.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.