Re: Problem with the depth and stencil buffers

New Message Reply Date view Thread view Subject view Author view

From: Angus Dorbie (dorbie++at++sgi.com)
Date: 04/27/2001 06:32:59


YOu have complete independent control over what stencil operation get's
applied on depth fail and depth pass. Just look at the glstencilop call:

glStencilOp( GLenum fail, GLenum zfail, GLenum zpass )

The first is stencil fail, the second two are stencil pass depth fail
and stencil pass depth pass. So just choose appropriate operations for
the ffail and zpass tokens.

Stencil testing is always performed first when it is enabled.

Cheers,Angus.

Eric Sokolowsky wrote:
>
> I'm having a strange problem with my Performer program which uses
> the stencil buffer. I run this program under SGI Irix 6.5 using Performer 2.2.
>
> Basically, I have a model of the earth and I want to select a portion of
> that model (a curved section delimited by a specific latitude and longitude
> set on each side) by placing a value of "1" in the stencil buffer where that
> section lies. So first I draw the earth model. Then I draw a pyrimidical
> wedge whose apex lies at the center of the earth and whose 4 edges pass through
> the boundaries I want to clip at to a point about twice the radius of the
> earth, where the base of the pyramid is located. (It's like an arrow or
> crossbow bolt sticking out of the surface of the earth.) This pyramid is
> drawn twice, with the first pass rendering the front-facing faces while
> incrementing the stencil buffer, and the second pass renders the back-facing
> faces while decrementing the stencil buffer. If I save the stencil buffer
> at each stage of the rendering I notice that the stencil buffer is not
> clipped at the surface of the earth at the end of the first pass of
> rendering the pyramid (the complete front-facing faces are
> seen), but if I also enable the color buffer to be written I see that it is
> being clipped at the earth's surface. In other words, you can't see the
> portion of the pyramid inside of the earth in the color buffer, but you
> can see it in the stencil buffer. What could allow the stencil buffer to
> ignore the depth buffer test while still allowing the color buffer to use the
> depth test? How can I make the stencil buffer respect the depth buffer test?
> Most of these functions are performed directly to OpenGL API functions made
> from callback functions called from the DRAW process. Any hints would be
> greatly appreciated.
>
> --
> Eric Sokolowsky Scientific Visualization Studio
> Scientific Visualization Programmer NASA Goddard Space Flight Center
> 301.286.3751 Code 935.0 Bldg 28 Rm S121
> esok++at++cosimo.gsfc.nasa.gov Greenbelt, MD 20771
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com

-- 
For Performer+OpenGL tutorials http://www.dorbie.com/

"Whenever there is a conflict between human rights and property rights, human rights must prevail." --Abraham Lincoln


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri Apr 27 2001 - 06:33:42 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.