explicitly setting z values

Is it possible to explicitly tell OpenGL what value of z to write to the depth buffer?

For example, I draw a triangle. I draw another that intersects that triangle. When the second triangle is drawn and wins the depth test, I would like a z value of say, 0.0 written to the z buffer, rather than the z value of the fragment.


No, I don’t believe so. However, you can explicitly set the z value of the fragment, but then of course, it might not pass when it should. On the other hand, the effect you seek could be done in two passes using a stencil buffer or alpha buffer.

[This message has been edited by DFrey (edited 02-12-2001).]