Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: boolean operation, quads and circle.

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2004
    Posts
    5

    boolean operation, quads and circle.

    hi, I need some help with this kind of boolean problem. I have a square (GL_QUADS) built up with four vertices and want to make a hole in the middle of this one.
    My idea is to make a circle and then take boolean between the square and the circle, to get a hole where I put the circle.
    But I don't know how to do this. If someone can help me I will be very thankful...
    I'm a beginner and using Microsoft Visual c++.

  2. #2
    Member Regular Contributor
    Join Date
    Aug 2003
    Location
    France
    Posts
    299

    Re: boolean operation, quads and circle.

    Magnuse, this is called constructive geometry (CSG). To do that, you'll need to use the stencil buffer.

    This is very simple :
    1/ Disable frame buffer writing (glColorMask)
    2/ Enable stencil writing
    3/ Render your circle
    4/ Disable stencil writing, enable stencil test
    5/ Render your quad

    The next step is to have a cube, and make a hole through it with a cylinder, or half it with a sphere. This uses the same technique, but I'll leave you think about it.

    SeskaPeel.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2004
    Posts
    5

    Re: boolean operation, quads and circle.

    thanx, I've done it now...

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Feb 2000
    Location
    France
    Posts
    1,118

    Re: boolean operation, quads and circle.

    As a side note, I'll add that if you're only interested in such boolean operations (i.e. making holes) with "flat surfaces", you may want to have a look at the Tesselator object available in the GLU library.

    It won't work for proper CSG though!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •