PDA

View Full Version : Depthbuffer & glColorMask



ml
01-06-2004, 12:44 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

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).]

Ostsol
01-06-2004, 08:42 AM
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.

dorbie
01-06-2004, 09:31 AM
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).]

ml
01-06-2004, 12:15 PM
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... http://www.opengl.org/discussion_boards/ubb/smile.gif
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