Depth test issues when rendering lines?

Hi,

I’m drawing a series of cylinders, and need to be able to render them both as full cylinders and also as a GL_LINE_STRIP.
I’ve been having trouble though with what looks like a depth test issue when using GL_LINE_STRIP.
Each line strip is drawn seperately, and I call GL_ENABLE(GL_DEPTH_TEST) before I draw each strip (don’t ask!). I am using GL_LESS and have tried setting the near plane to a value other than zero. The depth buffer is not being cleared between each line strip, but I am still getting some line strips drawn in front of others that I know are behind - I am verifying this by using a fragment shader that colours according to the distance from a fixed point.
Any thoughts on what could be causing this? I’m on an nvidia 6800 with 175.19 drivers.

Your help much appreciated

EDIT: I tried disabling GL_DEPTH_TEST and get exactly the same result.

screenshot please.

GLint depth_bits;
glGetInteger(GL_DEPTH_BITS, &depth_bits);
if (0 == depth_bits) printf("depth testing doesn’t work without a depth buffer
");

Screenshots:

The coloured bands represent weights for an opacity depth map. The image on the right uses cylinders, on the left are the problem lines.

arekkusu: Returns 24 bits.

I call GL_ENABLE(GL_DEPTH_TEST) before I draw each strip

wtf ? Why …

Make sure the pixel format for the window has depth bits associated with it …

Then just enable GL_DEPT_TEST
that’s all

I did say don’t ask! I’m interfacing with a third party API and scenegraph which only gives me access to the pipeline at certain points. Because of the way they do their rendering I have to do this in order to be sure that it doesn’t get unset by them.

are you really sure this is a depth test problem ? Have you tried to set the line width at a higher value ?

btw, there ARE maybe depth tests problems in the left image that we can’t see. Are your font and back planes set near enough of the shape ?

I’m not 100% sure this is a depth test problem but it does seem like it from the symptoms.

The main reason I think it’s a depth issue is that when the full opacity shadow map shader is used, it only looks correct when viewed at right angles to the light direction. That puts all fragments with a similar opacity value on top of each other, so a problem with depth testing doesn’t really matter. Otherwise it looks wrong, but in a way consistent with there being a depth test problem.

Changing the line width doesn’t help.

Depth range is initially 0-1.0 which works fine for the cylinders, but I change it to 0.1-1.0 for the lines as I’ve read a few comments about zero for near plane giving problems.

I welcome any other suggestions regarding what it might be!

Found it. The frickin API I was on about sets glDepthMask.