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
Hi,
You can use a stencil buffer algorithm to fill the intersection area. Try something like this:
- Enable clipping plane
- Draw front faces as usual
- Draw back faces setting stencil to 1 when depth test passes
- Disable clipping plane
- 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