Results 1 to 6 of 6

Thread: Polygon with a hole

  1. #1
    Member Contributor
    Join Date
    Jan 2001
    Posts
    60

    Polygon with a hole

    I would like to draw a polygon over an environment and then I would be able to see the scene just through a hole in this polygon. For exemple:

    ****************** ******************
    | || || || | + **** **** = ****| || ****
    | || || || | ** ** **| || || || **
    **** **** **** ****
    ****************** ******************
    scene cloudy polygon we just can see
    with a hole part of the scene

    Any ideias about how to make hole in a polygon?

  2. #2
    Member Contributor
    Join Date
    Jan 2001
    Posts
    60

    Re: Polygon with a hole

    Arghh!!!

    What happened to my ilustration??
    It does not accept "spaces"!

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Augsburg, Germany
    Posts
    334

    Re: Polygon with a hole

    1) You can draw the poly completely by yourself, which means you are free to bould it up of triangles.

    2) You could use polygon tesselation (search for tesselation in the docu).

    But if you know how the poly is shaped, build it up on your own as fixed code.


    Kilam.

  4. #4
    Member Contributor
    Join Date
    Jan 2001
    Posts
    60

    Re: Polygon with a hole

    The polygon should be a QUAD and the hole a circunference.
    Is there any way to subtract shapes? I mean, take a quad and subtract a circle... than the problem would be over.

  5. #5
    Senior Member Regular Contributor
    Join Date
    Sep 2000
    Location
    Lubbock, TX, USA
    Posts
    197

    Re: Polygon with a hole

    If you want the subtraction, the hole in the polygon, to be static, then the best solution is, to build the whole thing including the hole, out of triangles.
    If it's supposed to be dynamic (the position of the hole in the quad changes), you have 2 possibilities:
    1. compute the geometry of the polygon with the hole at the current position for every frame
    2. use the stencil buffer (draw the circle into the stencil buffer, then draw the quad everywhere where the stencil buffer is empty)

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Dec 2007
    Posts
    1,077

    Re: Polygon with a hole

    Sounds like shooting holes... Maybe use a 1 alpha bit texture (ie: transparent of not)? That wouldn't be very fast though (since you don't know which faces are behind it and would have to draw all). Maybe add little portals... Okay, sounds slow as well.

Similar Threads

  1. Drawing a hole in something
    By krump89 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-18-2008, 06:45 AM
  2. Creating a hole
    By jide in forum OpenGL: Advanced Coding
    Replies: 16
    Last Post: 04-13-2006, 04:41 AM
  3. I got a hole in my sphere!
    By talyrond in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-09-2006, 09:30 AM
  4. Hole
    By fabienne in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 10-13-2003, 03:00 AM
  5. cutting a hole
    By vjfrost in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 07-04-2001, 10:23 PM

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