PDA

View Full Version : how to hide object?



01-08-2005, 07:21 AM
I have created two objects, A and B. I want B to be shielded behind A so that partial of B is visible. How can I do that?

147-2
01-08-2005, 08:27 AM
If B is drawn behind A, and you want B to be occluded by A, then simply ensure depth buffering is turned on. The Z buffer should take care of the rest for you.

If you require A to occlude B in a situation where B is NOT behind A, you can turn off depth buffering and draw B first, then A. This is called "the painter's algorithm" because what you painted last in any given pixel is what will appear on the screen.

ZbuffeR
01-08-2005, 08:27 AM
Draw A first, then B.

Can you describe more precisely what you want ?
If you need more, use stencil test tricks.

01-08-2005, 09:01 PM
Actually I want my object A partially obscure B wnen viewed. Is there any useful and easy reference for me to refer to? I have read few OpenGL books, but I am not so understand how it is working, and there are quite number of HSR algorithms out there.