Depthbuffer & glColorMask

Hi,

I’m having some trouble with glColorMask(…) set to GL_FALSE for r,g,b & a.
It seems that when I set those to false, the depthbuffer isn’t written to? I was under the impression that it should only mask writes to the colorbuffer.

I’m using it to discard certain polygons.
They shouldn’t be visible in the framebuffer, but their depth should still be there, so that they can occlude other, ‘visible’ polygons.

Anyone care to help me out? I’m having trouble describing the problem, ask if anything is unclear

Edit: I used glLogicOp(GL_CLEAR) instead and it works as expected, but I still wonder about glColorMask-issues.

[This message has been edited by ml (edited 01-06-2004).]

I have no idea, but it might help others if you post what video card you’re using, as it might be an implementation- or driver-specific issue.

It should work. You could try adjusting your glBlendFunc to do the equivalent of not contributing fragments to the color buffer by setting to glBlendFunc(GL_ZERO, GL_ONE); and enabling GL_BLEND.

This is probably inefficient but it will at least get you functional on buggy cards.

[This message has been edited by dorbie (edited 01-06-2004).]

Doh.

Thanks for the suggestions.
I’m almost too embarrased to tell you what it was. Let’s just say that I got correct behaviour originally if the polygon that was ‘discarded’ was drawn first…
I made a small test-app that worked just fine with all of the above methods, I just wasn’t thinking hard enough before.

ML