I’m trying to write codes to show objects(sphere,cylinder…etc) inside a volume defined by a Bezier surface and a polygon (looks like a hemisphere), objects not inside this volume should be hidden.
The way I’m currently using is:
glStencilFunc(GL_ALWAYS, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
glStencilFunc(GL_EQUAL, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
if I look far away from it, it “looks” ok.
It shows a hemisphere with spheres, cylinders inside it.
Now, the problem comes. When I try to slice it(by changing the difference of the last two parameters of gluPerspective to a really small number), objects inside won’t show up.
In other words, what I’m expecting is something like a “D” shape boundary with circles, and lines inside it.
Any suggestion is appreciated.