PDA

View Full Version : How to get intersection points?



helen1010
12-16-2002, 04:25 AM
I use glEnable(GL_CLIP_PLANE0) to cut a object,for example a stone. OpenGL can only show part of the stone. But the intersection region is not filled, and it is not real.

How can I fill the intersection region between the plane and object or get these intersection points generated by the plane to cut the object?


thanks!

helen

JustHanging
12-16-2002, 04:58 AM
Hi,

You can use a stencil buffer algorithm to fill the intersection area. Try something like this:

1. Enable clipping plane
2. Draw front faces as usual
3. Draw back faces setting stencil to 1 when depth test passes
4. Disable clipping plane
5. Draw the clipping plane (or maybe just a fullscreen quad) updating only pixels that have stencil = 1

I think that should do it, altough I've never actually done that myself.

Good luck,
-Ilkka