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?
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.
Draw A first, then B.
Can you describe more precisely what you want ?
If you need more, use stencil test tricks.
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.