Is there a way to cut a part of the screen?

Hi!
I would like to draw a rectangle on the screen that will delete everything inside. For example if I draw a red square on my screen and then draw a smaller rectangle inside, it will cut it and appears like the rest of the screen. I use the GLUT library. Any help would be appreciated.
Thanks!
LD

You should be able to do what you want with the stencil buffer. Basic steps would be

  1. Draw your small rectangle to the stencil buffer
  2. Enable the propery stencil test and draw your big rectangle.