Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: how to hide object?

  1. #1
    Guest

    how to hide object?

    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?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Oct 2002
    Location
    San Diego, CA, USA
    Posts
    209

    Re: how to hide object?

    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.

  3. #3
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,575

    Re: how to hide object?

    Draw A first, then B.

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

  4. #4
    Guest

    Re: how to hide object?

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •