PDA

View Full Version : reconstruct poly from stencil or clip buffer



th0r1000
03-05-2006, 04:13 AM
I clip a 3d object then i use the stecil buffer to fill the cutoff. Is there a way of constructing the polygon out of the stecil or clip buffer. Any help would be appreciated.

Ehsan Kamrani
03-07-2006, 04:36 AM
If i understand your meaning, there are two ways to clip the objects:
1.The stencil Buffer
2.Clip planes
However , some functions such as gluPerspective(), glFrustum() and glOrtho() define a view volume that clips some objects .
-Ehsan-

Relic
03-07-2006, 04:54 AM
Originally posted by th0r1000:
I clip a 3d object then i use the stecil buffer to fill the cutoff. Is there a way of constructing the polygon out of the stecil or clip buffer. Any help would be appreciated. No, not inside OpenGL. Using any of the rasterization informations on screen will never match good enough.

You should calculate the intersection of your polygon with the clip plane yourself for a perfect fit.
This can get arbitrarily complex depending on the number of individual polygons the clipping generates.