From: Angus Dorbie (dorbie++at++sgi.com)
Date: 02/21/2000 09:48:04
You might be able to do the back hemisphere of a sphere using the depth
buffer. If you aren't to worried about depth buffering use a similar
approach for the front hemisphere of a sphere and use a clip plane at
the equator to join the two.
Otherwise some form of multipass approach using the stencil buffer will
work.
Draw the scene to the framebuffer, draw the outside of a sphere with a
stencil increment, and the inside with a decrement while depth testing
against the scene. Increment/decrement on a depth pass, keep on a depth
fail.
You then clear the screen (or you could mask the color buffer in the
first pass) and clear the depth buffer (you might get away without depth
clear depending on the OpenGL implementation). Redraw the scene with a
test for equality with a value of one. Note that this will be a pixel
fragment operation, no clipping of the actual geometry will occur but
the visual result will be the same.
See the UAV example on my web page for useful information & code on this
kind of thing.
Cheers,Angus.
Philip Fu wrote:
>
> Dear all,
>
> I would like to implement a clipping sphere
> using clipping planes. However, from OpenGL, there
> are six clipping planes only. Is there any clever
> method to implement this in Performer?
>
> If possible, the method has to be run
> interactively.
>
> Thanks in advance!
>
> Philip
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
-- For Performer+OpenGL tutorials http://www.dorbie.com/ My comment on the abuse of Jon Johanson's rights; After giving up raiding their neighboring countries the Norse men have taken to raiding 15 year old kids in their bedrooms. Very sad.
This archive was generated by hypermail 2b29 : Mon Feb 21 2000 - 09:48:25 PST