Drawing "Overlay" problem...

Hi guys!

Question from total noob… :slight_smile:

If I want to make sure that I will draw a shape over the staff which is already drawn is it enough to clear the Depth Buffer before I draw that shape?
It works for me fine that way provided that I didn’t draw any transparent shapes before (especially transparent & having depth test / depth buffer off). But if I do draw transparent shapes and played with the depth buffer before, than even if I clear depth buffer before I draw the shape, the one I want to be in front, some transparent shapes which I draw before will pop up in front… Why? ???

Thanks in advance…

Bohdan.

Edit: actually, I a bit wrong… not that transparent will pop up in front, but that shape I draw the last, will be drawn like it actually went through depth test (though the depth buffer should be clear at this stage already)… ???

Anybody, any hints? Please…
Just driving me mad…, can’t understand why clearing depth buffer is not always enough ???

Problem is resolved ;D. Wrong set depth mask was the answer ;D

Cheers,
Bohdan.

Can you post your code or what depth mask and did you use to draw this?

Basically, the problem was that somewhere in the drawing procedure, before I draw “overlay” shape, I had writing to depth buffer disabled, consiquently “overlay” shape never appeared in depth buffer (and I thought it was), so when transparencies where drawn next, they just was not checked (depth test) against this shape and went over it… that’s it… I just by mistake left writing to depth buffer off, and forget about that and couldn’t spot it for a while :o .