GL.Lines flicker when moving camera, and appear "broken" (screenshot inside)

If you zoom in on the pic above, you can see that there are white lines on the screen.

Those are drawn with

GL.Begin(GL.LINES);
GL.Vertex(points[i]); // that's in a loop but whatever
GL.End();

The lines disappear randomly as I move the camera around, and they dont appear continuous randomly.

I’m using Unity 2019.4.15, URP.

Any idea what setting I need to change for the lines to be clean?

Btw, my goal is to let the user select voxels, and have a grid drawn over those selected voxels. I probably shouldnt use GL.Lines, 1px doesnt seem large enough… Any suggestions? LineRenderer? Vectrosity?

Well, we don’t know what shader / material you use and we also don’t know when and where you draw those lines. Do you use any post processing?

Keep in mind that GL.LINES draw individual lines. So you have to call two GL.Vertex for every line you want to draw.

Usually the actual OpenGL “Lines” mode allows to specify a line width. However Unity does not have such a setting. So GL.LINES will always be a 1px line. Possible solutions are to actually draw quads instead of lines, however of course that requires a bit more efford. Of course you can use a line renderer or Vectrosity if you have it bought it.