Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / 3D Theory & Graphics / Artifacts with OpenGl line primitives Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

May 29, 2005, 07:45 AM

Hi there =)

I have got a small problem with OpenGl, using GL_LINE primitives to render a grid structure.

Whenever a line primitive ends up large in relation to the window size, or if one end point is outside the visible window area, artifacts are generated.
The resulting on-screen line looks as if stippled.

Additionally, this behaviour only occurs for lines that are running at a near-to 45 degrees angle.

I already tried around with the near/far ratio to no avail, turning of depth buffering altogether didn't help either. My camera projection matrix and world transform also seem alright.

Replacing a long line with several shorter GL_LINEs seems to help a little bit, but still results in artifacts when the shorter line is partially offscreen. Also, for larger grids, this method seems undesireable.

I'd rather not fall back to using quad slices, or a single grid-textured quad.

I can't remember seeing this behaviour on my old NVIDIA card, so I think it's a driver or hardware problem. I am currently running on the newest ATI drivers though.

Did anyone out there observe a similiar problem? Is there a -simple- solution? Does anybody have any suggestions on what to do to solve that problem?

Thank you,

- Wernaeh


May 29, 2005, 08:51 PM

What exactly is happening to the lines? You could screen capture and have a closer look.

My only idea is to turn on blended antialiasing, like so:

  2. glEnable(GL_BLEND);
  4. glEnable(GL_LINE_SMOOTH);


May 30, 2005, 02:07 PM

Wernaeh, I've never seen this behaviour (and judging by the number of replies you got, apparently the same holds for other people as well), but if you could build a test-app to reproduce this exact behaviour (exe with sourcecode orso), or just a 'sufficient' code-snippet, I would of course be more than willing to so some testing (although I am running a Geforce6600GT, a Geforce4 and a Geforce256 here), and I am sure the same would hold for loads of the other flipcode guys.


May 30, 2005, 02:19 PM

Yes, put a little test app together, I'll happily run it on my 9600.


May 30, 2005, 03:10 PM

Thank you all for your offers =)

Your suggestion is among the things I already tried. It results in very nice, antialiased line stipples ;). Nevertheless, thank you for your input =)

I have made a screenshot of my problem, and I zipped and uploaded my app so you can have a try.

I am really sorry if downloading or looking at the image fail because I used up my traffic quota. I haven't had the time to get a proper webhost up to now.

To see the artifacts, unzip the file into some directory, enable using the path settings from the zip file. Start the FrontEnd.exe application. Then, select "Editor" in the modules combobox, and click the "Launch" button. You can move the camera by holding down the right mouse button, and then use the arrow keys to move. Most artifacts appear when banking. To do so, hold down the right mouse button, and use the "Delete" and "Page down" keys.

I'm sorry for the inconvenient user interface, but I'm still working on it ;)

I can also post relevant code sections if desired, or the entire code if anyone is interested in it. I don't think this will be of any use, though. I just need to initialize a GL context, and then use arbitrary GL_LINES to reproduce the error.

Thank you again for your help,

- Wernaeh

Chad Austin

May 30, 2005, 08:57 PM

Hi Wernaeh,

I don't see the same effect on my Radeon 9800... I'd guess a driver/hardware problem.


May 31, 2005, 01:04 AM

GF4 Ti 4200, nothing wrong here. Just like you said, smells like rotten drivers or hardware problem.


May 31, 2005, 06:32 AM

Thank you all for testing =)

In the meantime, I tried on my brother's computer, using the same drivers and graphics board as in mine (ATI radeon 9600 chipset), and the artifacts didn't appear on his box, either. So I guess there is something wrong with my graphics board =/

Well it anyways was time for a new machine;o)

- Wernaeh


May 31, 2005, 07:01 AM

If it makes you feel better, I got the same artifacts (although they were rare). I have a Radeon 9800 and reasonably up to date drivers (not more than a few months old at least).
As I said - I had to make an effort to get the artifacts, they only appeared at very specific angles. I would not say it's a huge problem, although it's of course annoying and shouldn't be there... I can't remember having seen it before.


May 31, 2005, 08:05 AM

No problems on my Radeon 9600 with Catalyst 5.5.

I think it's strange. It doesn't look like a heat problem, nor like a bus transfer problem or so. Why should a specific system/card combination fail to render certain lines correctly ?


May 31, 2005, 10:26 AM

Perhaps something went wrong with the GPU dies, just remember the infamous Pentium fp-divide bug. I don't know, though. If I find time, I will mail ATI about it, and see what they've got to say about it.

- Wernaeh

Rui Martins

May 31, 2005, 11:26 AM

It can be the power supply, not powerfull enough, or to many stuff in the systems, extracting the joice out of it.
Try removing something superflous like an extra CDROM drive or board you don't use.
You can also acquire a more powerfull power supply, but that is more expensive, for just a simple test.


May 31, 2005, 03:26 PM

Also got those artifacts. Radeon X800 XT. Reasonable new drivers. I use OpenGL all the time and never ever got such problems with GL_LINES.


May 31, 2005, 08:38 PM

Woohoo I have artifacts! Radeon 9600SE, latest drivers.


May 31, 2005, 10:13 PM

Those damaged lines are really rare though.
Wernaeh: could you perhaps add some coordinate edit fields or so? Maybe those guys reporting no artifacts were just lucky...

This thread contains 15 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.