Conflict between depth test and line smoothing

Hello,
I’m drawing a mesh with the OF_PRIMITIVE_LINES mode. To smooth the lines I use this:

    glEnable(GL_LINE_SMOOTH);
    glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);

The problem is that when I enable depth test (with ofEnableDepthTest), small gaps appear between the lines. You can see it in this image:

However if I enable only depth test or only line smoothing, these artifacts doesn’t appear.
Do you have an idea of what is causing this or how to avoid this?

Hi there!

I don’t know if I’m going to be any helpful… But that’s a moiré pattern. I, sometimes, play around if that when I do some print materials.

One easy fix can be to lower the amount of lines. But if you want to keep that, maybe use different mipmap settings or a manual MSAA? edit: don’t know if it actually solves the problem, just a thought

Yes there is also a Moiré pattern but that’s not my problem (for the moment). I finally used MSAA instead of GL_LINE_SMOOTH and it worked.
Thanks anyway :wink: