Is there a way to clear everything at a certain depth but not below it?

I have a drawing program and I want the drawing to always exist, but I’m trying to show a cursor. In order to draw the cursor moving, I have to clear it. I was hoping I could accomplish this with some sort of depth trick.

Any suggestions?

Depth tricks won’t work here.
Use a FBO to save the drawing in.

so i did some reading on FBO. Are you suggestion that I render my drawing as a texture in an FBO and then use that as my background texture? something like that…

Yep, that’s how it’s meant.