Results 1 to 6 of 6

Thread: How to erase part of the drawn objects?

  1. #1
    Member Contributor
    Join Date
    Jun 2003
    Location
    Hamilton,On,Canada
    Posts
    55

    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!

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: How to erase part of the drawn objects?

    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!

  3. #3
    Senior Member Regular Contributor
    Join Date
    Sep 2002
    Location
    Poland
    Posts
    196

    Re: How to erase part of the drawn objects?

    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).]

  4. #4
    Guest

    Re: How to erase part of the drawn objects?

    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.

  5. #5
    Senior Member Regular Contributor
    Join Date
    Sep 2001
    Location
    Eastern USA
    Posts
    218

    Re: How to erase part of the drawn objects?

    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).]

  6. #6
    Member Contributor
    Join Date
    Jun 2003
    Location
    Hamilton,On,Canada
    Posts
    55

    Re: How to erase part of the drawn objects?

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

Similar Threads

  1. Replies: 6
    Last Post: 02-12-2013, 03:37 PM
  2. [SOLVED] Objects drawn in odd order
    By metalac in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 12-09-2010, 10:50 AM
  3. Small objects are partially not drawn
    By AstroBistro in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 05-11-2010, 02:38 PM
  4. Objects aren't always drawn
    By Shelling in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-16-2008, 11:18 AM
  5. using camera, but objects are being drawn above my view
    By Andrew Davey in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-27-2004, 11:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean