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: Selection and Picking for VBO objects

  1. #1
    Intern Contributor
    Join Date
    Jun 2009
    Posts
    92

    Selection and Picking for VBO objects

    Hello,

    How can i perform selection and picking for a triangular mesh which is displayed using VBO..?

    Thanks in advance

  2. #2
    Member Regular Contributor Rosario Leonardi's Avatar
    Join Date
    Aug 2008
    Location
    Italy
    Posts
    356

    Re: Selection and Picking for VBO objects

    I don't see any connection between picking and VBO.
    If you are starting a program now and you want to use the "gl*Names" i suggest you to change strategy.

    For picking I suggest to put your objects in a BPS (or octree, or kd-tree or any space division structure) make a rough pass to select the bounding box (or bounding sphere) and then remove false positive by checking every triangle in the mesh.

    It really depend on the number of triangles and the number of the object. If you have only one object with a lot of triangle the tree structure is useless and maybe you can use some algorithm to partition the mesh.

    It also depend in the precision you need, in a lot of cases bounding volume are enough.
    ~ ~ I tell you, realtime 3D is made of blood, sweat and screams! ~ ~

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2009
    Location
    Princeton, NJ
    Posts
    19

    Re: Selection and Picking for VBO objects

    I'd recommend the method of rendering each object in a unique color to the back buffer and using glReadPixels to read the color at the cursor pos.

    You can encode 2^24 different values into RGB, if you have >2^24 triangles then you'll have to do multiple passes.

    Advantage over the above method is that all you need to write is a custom render function, rather than altering your fundamental data structure or having to introduce more matrix math etc.

    See http://www.opengl.org/resources/faq/.../selection.htm

    and http://www.opengl.org/resources/faq/...color.htm#0050

  4. #4
    Junior Member Regular Contributor
    Join Date
    Aug 2009
    Posts
    126

    Re: Selection and Picking for VBO objects

    I just render my Mesh into a FBO (with clear Depth-Buffer), and then test with glReadPixels if there is a depth. But that works only if you want to select your whole mesh, not different triangles


    ^^


Posting Permissions

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