making stuff disappear

I want to create a scene where whatever I’ve drawn disappears beyond a certain depth (negative z direction). i.e., if I have some 3D shape and I translate or rotate it and in doing so, any portion of the shape goes beyond a certain depth (specified by me) into the screen, I want that portion to disappear. Also it should reappear if it comes forward in front of that depth. Kind of like an interdimensional portal located at a certain depth in the screen. How do I accomplish this?

I think you are talking about the zfar plane. This is a fundemental part of 3d graphics - have a look at the functions gluPerspective and glDepthRange. This is ample information out there.

I though you have to say “Presto!!!”

Originally posted by Shag:
I think you are talking about the zfar plane. This is a fundemental part of 3d graphics - have a look at the functions gluPerspective and glDepthRange. This is ample information out there.

Or you could use clipping planes, depending on whether you want some of the geometry to appear behind the portal, also.