How to remove pixel from the framebuffer?


I want to draw a square and then dig a smaller rectangle hole in it. Is it possible to clear some pixels from the framebuffer for this purpose? Thank you very much!

Best wishes,

I know that I can do this by only drawing the parts except the hole. But I am wondering whether it is possible to draw something in the framebuffer and then remove pixels from it? Thank you very much!

I have used the stencil buffer to do this but found that stencil buffer seems not work in Firefox and only Chrome. Does anyone have similar problem? Thank you!

Have you drawn something into the framebuffer before? If yes, you can render your square into an extra texture (renderbuffer object) and blend that over the framebuffer. For making a hole you can set the alpha value in this texture to zero.