Lines in different position


I run my OpenGL program on side-by-side PCs on my desk. When I draw lines with GL_LINES or GL_LINE_LOOP, they are positioned differently on my 2 different PCs. The lines are sometimes offset by one pixel down, and one left. Quads seem to be positioned the same.

Both machines have GeForce video, XP, and current drivers.

What might be causing this?



I’m developing a multi-player game, so I run the same program (same executable) on both machines and immediately see the slight differences in line drawing.

My opengl32.dll has a slightly different date on each PC, but the file-size is exactly the same.

Would seeing a sample image help?

From what I know this happens with nvidia and ati but not sure. Do you use only xy for draw lines? Maybe orthographic projection? If so you could try increasing them with 0.5f. Sometimes this fixes the problem.

The OpenGL spec allows implementations to differ by one pixel for line rasterization.

spec 2.1, section 3.4.1 Basic Line Segment rasterization, page 102, end of the page:

“Because the initial and final conditions of the diamond-exit rule may be difficult to implement, other line segment rasterization algorithms are allowed, subject to the following rules:”

page 103:
"1. The coordinates of a fragment produced by the algorithm may not deviate by
more than one unit in either x or y window coordinates from a corresponding
fragment produced by the diamond-exit rule.
2. The total number of fragments produced by the algorithm may differ from
that produced by the diamond-exit rule by no more than one.

Also, do you use some antialiasing method? (GL_LINE_SMOOTH? multisampling?)

Thanks for the info.

In my game environment, line-drawing is not important, but I’m developing some dialog boxes where outlines and shading are one-pixel thick, so it’s very noticable.

I’ll try using Quads or Tris and see if it helps.