PDA

View Full Version : Stencil buffer



11-20-2003, 02:24 PM
What i want to do is to make a rectangular box and be able to "cut" a cylinder out from 1/2 of it (i.e. the outer edge of the cylinder will be in between both sides of the box, makeing the center along 1 edge of it) so that i can see behind and in front of the cylinder, but everything where the cylinder is gets cut out. Well, i tried using the stencil buffer, but my book only covers about 1 page on it, and i havent been able to find any tutorials on it. I have gotten it so that everything in and behind the cylinder is cut out, but i want to keep the stuff behind it visible. Is this the way or is there a better way to do this?

cwc36
11-20-2003, 06:18 PM
Hi,

Try on this website to get the stecil buffer example.
http://myopendemo.hypermart.net/opengl3.htm

11-20-2003, 06:45 PM
thx for the tutorial, it really helped a lot, but let me refrase my question...
basically what i am doing is creating a pool table. now, the side pockets are the only thing left that i dont know how to do. if you look at a pool table, it has a half indented circle in the side wall where the pocket is, so i want to recreate this. So how should I go about doing this?

virtualchetan
11-21-2003, 06:06 AM
If u want to clip against a 2D region or a 3D space, u can try glClipPlane

- Chetan

11-21-2003, 08:15 AM
Ok, but remeber that its basically a half clyinder I want to clip out (it doesnt matter if its a half or a full cylinder, which would be easier neways), so it is 3d. I guess I could clip circles out along the Z axis making it like a cylinder, but I would think this would be very ineffecient.