How to erase part of the drawn objects?

Hi! I draw a lot of objects in the viewport, and then if I want to erase one of them but don’t want to clear the whole buffer and draw everything else again. Can I do that?
Thank you!

No, not that I know of.

Originally posted by earth_walker:
Hi! I draw a lot of objects in the viewport, and then if I want to erase one of them but don’t want to clear the whole buffer and draw everything else again. Can I do that?
Thank you!

You have to draw everything again without that polygon. This is only the way.

[This message has been edited by glYaro (edited 07-26-2003).]

You can erase a selected object using the stencil buffer. When you draw the selected object you call glStencilFunc(GL_ALWAYS, 1, 1) and glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE). And when you want to erase it you call to glStencilFunc(GL_EQUAL, 1, 1) and glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP) and simply draw a big black rectangle with GL_DEPTH_TEST off. This will erase everything in your object’s outline.

Do you think this would be more versatile for the first step?

glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);

Otherwise after that step you will have the complete silouette of the object in the stencil buffer. If parts of the object were occluded by other objects during the depth test you probably don’t want stencil updating to occur.

[This message has been edited by Omaha (edited 07-27-2003).]

Thank you! I will go to read the stencil part of OpenGL reference.