Results 1 to 3 of 3

Thread: Region Selection Opengl

  1. #1
    Senior Member Regular Contributor
    Join Date
    Nov 2003
    Location
    Michigan, USA
    Posts
    184

    Region Selection Opengl

    Does anybody have any ideas how I could go about doing region selections. That is given a selection region defined by something like a lasso tool, select all polygons that lie in region. The region would be extruded along the z direction for infinity. The I would apply regular modelview transform to geometry. Any methods to do this efficiently?

    Precision is not critical, ie few dozen polygon extra. Also, it is okay if I select several object's polygons if they overlap.

    Could I stencil buffer for this approach?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Nov 2003
    Location
    Michigan, USA
    Posts
    184

    Re: Region Selection Opengl

    Sorry to bump my own thread, but I was really hoping someone would have an answer. I have searched online and found very little on this. Thanks.

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2004
    Location
    Reggio Emilia, Italy
    Posts
    18

    Re: Region Selection Opengl

    I had to do some kind of selection too lately. There are several way to do it. One is trying to figure out a way to project your mouse position in Object Space with an increasing depth value, but it would turn out to be complex and expensive.
    The redbook itselfs explains a method using a specific openGL state ( the SELECTION state ) that does all the dirty work for you and returns a name for each polygon that is selected. This might be more simple, though you'll have to name each primtive in the scene, and it sounds to me like it's still quite expensive.
    What I finally decided to do was to take a different approach that works quite well and that's not so expensive. All you have to do is render your scene twice :
    1) First you render the scene with only depth testing enabled, you give each object a unique color so that you can use it to identify the object. You read the resulting framebuffer in system memory with glReadPixel and keep it to detect selection
    2) You render your scene as usual

    When you need to know what's selected, you just check the pixel from the selection pass that stand in the selected area, and if you find a color that corresponds to a specific object you now that object has been picked.

    Of course you can balance performance/precision by modifing the resolution when you render the first pass, I personally found out that a 64*64 area is sufficent for selecting objects at a reasonable distance.

    Hope I helped you somehow, I don't know if you are able to use multipass, in case you need help I'll be checking this post for a while!

    Byez =!
    Ob1
    Byez =!
    Ob1

Similar Threads

  1. How to implement region selection?
    By sguTiger in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 07-17-2009, 02:29 PM
  2. How to clear a region of a window in OpenGL-ES
    By mustaf in forum OpenGL ES
    Replies: 6
    Last Post: 01-14-2009, 09:18 PM
  3. Problem with Region selection!
    By HanWu in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 12-14-2006, 10:35 PM
  4. selection with a polygon region
    By vbovio in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 12-08-2006, 06:29 AM
  5. Selection over a polygonal region
    By Mohamed Hassan in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 10-28-2003, 02:34 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