Results 1 to 2 of 2

Thread: Picking, choosing nearest object

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2011

    Picking, choosing nearest object


    I just learned technique called picking, i learned it from these 2 tutorials and

    although I do my program in jogamp, so i code in java instead. Next, I managed to implement the scenario...and my objects now react to the mouse perfectly apart from one condition, which is when there are multiple objects crossed by mouse cursor I am unable to identify which is the nearest one.

    From tutorials I have believed the information will be given by returned buffer (array), the same one from which i get object names which are hit by mouse. At the very bottom in this tutorial there is a list_hits method. It does mention Z min and Z max values which should be coming as the second and third elements of buffer.

    In my program i always receive same value (-2.14xxxx), for all objects which are picked and regardless of their position in the scene and my lookAt the scene.

    How do I solve this?

    Because so far all my objects are primitive spheres, it would help if i draw objects in order from farthest to nearest. That would give me always nearest object on picking too. But what if later my objects will carrying more complex shapes? I am not sure if this technique will be enough to get precise results.

    What more do i have to do so the z-min and z-max values are retrieved correctly from selection rendering mode?

  2. #2
    Junior Member Newbie
    Join Date
    Feb 2011

    Re: Picking, choosing nearest object

    Finally I found out it was a problem of jogamp.
    Version I had didn't support the depth value properly, I downloaded newer version of jogamp and it began to work, apart the fact that new version has other rendering issues i noticed immediately )))) nevermind, java is java

Similar Threads

  1. What is the best method for object picking?
    By gmseed in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 04-19-2012, 03:29 PM
  2. picking object
    By newasun in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-24-2005, 01:21 AM
  3. Object Picking
    By Montoya in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-22-2003, 12:12 AM
  4. Problems picking the right object
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-06-2001, 08:04 PM
  5. Object picking...
    By Spotaszn in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 12-11-2000, 03:11 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