I did try to write to gl_FragDepth, but it had no effect... Here's some trimmed test code: http://pastebin.com/YD9pu0TU
Basically, I draw two planes -- a red one fairly close, and a blue one that should be completely occluded by the red plane. As you can see in the demo though, the blue one still gets drawn on top of the red one...

On Fri, Feb 24, 2012 at 7:43 AM, Ian Mallett <geometrian@gmail.com> wrote:
On Fri, Feb 24, 2012 at 6:03 AM, James Gao <james@jamesgao.com> wrote:
Sorry for spamming the list, but I've seem to find another problem with my code. I can't seem to get depth test to work. I've checked all the usual suspects -- glEnable, glut is allocating the depth buffer. I'm using almost exclusively glsl 1.1 (no fixed function commands) -- is there something I must do in the shaders themselves in order to get depth test to work?
You can write to gl_DepthCoord, but typically this is implicitly done as glFragCoord.z.

Can we see code?