Problem with the depth and stencil buffers

New Message Reply Date view Thread view Subject view Author view

From: Eric Sokolowsky (esok++at++cosimo.gsfc.nasa.gov)
Date: 04/25/2001 16:59:26


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


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Apr 25 2001 - 16:59:33 PDT

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