Fragmented lines

How come my lines are so fragmented:



http://img397.imageshack.us/img397/3470/simplegamescreenshotvl0.png



Sometimes, although being close to camera, a line isn’t drawn at all:



http://img141.imageshack.us/img141/2769/simplegamescreenshotms3.png



This is what I am doing:


Line l = new Line("l", points , null, colors, null);
l.setAntialiased(true);
l.setLineWidth(1.0f);
l.setModelBound(new BoundingBox());
l.updateModelBound();
this.attachChild(l);
//where points contains two Vector3f instances and colors contains two ColorRGBA instances



Can somebody please point out my mistake?

What your looking for is antialiasing. Try display.setMinSamples() in your display code.

I already have set the minimum samples to 8 in the initialization routine of the game and have added antialiasing by applying an AlphaState to the parentNode of the lines (as you can see in the first picture). Also I did call setAntialiased(true) on the lines. For results see pic1.



Making the lines thicker results in visual fragments, too.

What kind of card are you running? Does it support 8 samples? Have you tried 2, just to see?



Other than that it seems you've done it all right. The problem of not showing up at all could be z fighting. Is your grid offset any?

It does look a bit better with only 2 samples, although my card should support more. Yet, it doesn’t seem antialiased.



Does that look antialiased to you: http://img376.imageshack.us/img376/5964/simplegamescreenshotjh0.png



And I don’t even know what you mean by Z-Fighting and grid-offset, I am more or less a noob to 3d programming. The lines should be visible even if they were behind the map, since the map is transparent.

Try removing the map itself and see if it works better… If so, then you could do Polygon Offset (search the forums) to make sure you draw the lines in front of your map, if not, then you first need to come up with setting that would draw the lines neatly.

duenez said:

Try removing the map itself and see if it works better... If so, then you could do Polygon Offset (search the forums) to make sure you draw the lines in front of your map, if not, then you first need to come up with setting that would draw the lines neatly.


Yes, you're right, the lines look perfect without the map. Gonna tackle that PolygonOffset thing.

I thank thee much for this hint! Works perfectly now!