Link to a article describing how to do this with the stencil buffer trick:
http://www.opengl.org/resources/code/samples/advanced/advanced97/notes/node11.html
If you need a real geometric solution and not just a visual one, you need to implement geometry CSG substraction. This is a pretty complex issue to describe here in the boards.
A simple method:
Object A = your original object (must be a closed single surface volume)
Object B = the clipping object (must be a closed single surface volume)
1. Go though all object A faces (triangular polygons). For each face check which object B faces are intersecting it.
1.1. Split the object A face by the plane of the object B face (the original face is replaced with 2 faces). For all the later intersection tests use the new splitted faces instead of the original face.
2. Go though all object A faces, and remove the faces with center point inside the object B mesh.
2.1. One way to detect if a point is inside mesh is to cast a ray to any direction. If the ray closest intersection is to the backside of a face, then the point it inside. If the intersection is to the frontside of a face or there is no intersection, then the point is outside.
3. Now your object A is processed and ready.
4. Split all object B intersecting faces with object A faces like described in step 1. Use the original object A in this case, not the processed one.
5. Go though all object B faces, and remove the faces with center point OUTSIDE the object B mesh. Use the same point inside/outside test you already implemented for the step 2.
6. Flip the faces of object B.
7. Now your object B is processed and ready.
8. Add both processed object faces together to one single mesh.