Circular Mask without Overlay/Stencil

I am trying to draw a terrain scene overlayed with a circular mask.

I can do this fine with an overlay plane using colour index mode by drawing a black rectangle over the entire screen and then drawing a transparent circle (using glut) to ‘cut-out’ my circular mask.

However, how can I do this without an overlay or stencil plane? I am thinking of a GeForce4 type PC where they might not be available. I have heard about ‘pbuffers’ but can’t find any examples on using them.

Thanks in advance.


You’re making this a bit hard, can’t you just draw the terrain first and then draw the mask on top of it. Mask being a black texture with zero alpha in the circle and one elsewhere. You can then use alpha test to cut out the circle.

Better yet, you can draw the mask before the terrain, drawing it very close to near clip plane. This way the parts of the terrain that are masked get depth tested out, which might save you some fillrate.