draw many objects with a region no shown/drawn

Dear my teachers

I want to draw many objects like rivers and roads with a region no drawn.
For example, some objects or parts of them inside a rectangle region can’t be shown, while others outside the rectangle will be showing.

I try do it with glClipPlane(). But it cuts the half-space of model, not a region.

How do I do?

thanks

Stencil is what you are looking for.
Basically you mark the stencil buffer with the pixels that you want to draw/not-draw on. This is done by rendering the regions with glColorMask(FALSE,FALSE,FALSE) and approriate combination of glStencilOp/glStencilFunc.
Then you switch to glColorMask(TRUE, TRUE, TRUE),
select the glStencilFunc/glStencilOp to select the pixels you want to render on and render your scene(rivers and roads).

Check the chapter in the red-book for the details.
Thanks,
Jacky

I would just render some polygons at the near plane so that they occlude everything behind them.