Results 1 to 6 of 6

Thread: picking: don't want to pick hidden objects

  1. #1
    Guest

    picking: don't want to pick hidden objects

    hi
    i got one problem: when i pick, i get also hit's from objects that are hidden by other objects and thus not visible. how do i stop openGL from returning hits for invisible objects?


    thanks for help
    _________________
    -- hENON

  2. #2
    Senior Member Regular Contributor
    Join Date
    May 2003
    Location
    Germany
    Posts
    229

    Re: picking: don't want to pick hidden objects

    You can't stop GL from also picking "hidden" objects unless you remove them by yourself.
    But I see no problem in this, as you also get the Z-Values of the hits in your hit-buffer, which you can use to determine the nearest objects.

  3. #3
    Guest

    Re: picking: don't want to pick hidden objects

    thank's that's what i need.
    is there even more information in the hit results i dont know of?

  4. #4
    Senior Member Regular Contributor
    Join Date
    May 2003
    Location
    Germany
    Posts
    229

    Re: picking: don't want to pick hidden objects

    Every hit in your selectionbuffer consits of a total of four values in this order, where n is the hit you process :

    SelectBuffer[(n*4)] = Number of objects on the stack when the hit occured
    SelectBuffer[(n*4)+1] = Smallest Z-Value of all vertices of the hit object
    SelectBuffer[(n*4)+2] = Biggest Z-Value of that object
    SelectBuffer[(n*4)+3] = Name of the hit object

    Hope this answers your question!

  5. #5
    Guest

    Re: picking: don't want to pick hidden objects

    yeah, thats great.

    i suppose the order in the hit record depends directly on the order i am drawing the objects.

  6. #6
    Senior Member Regular Contributor
    Join Date
    May 2000
    Location
    Oxford, England
    Posts
    472

    Re: picking: don't want to pick hidden objects

    You could always use the hacky colour buffer trick where you draw the objects to the backbuffer only. Each object has it's own ID specified in the colour (use glColor3ub or glColor4ub) read the pixel back from the backbuffer.

    The benefit of this is that if you enable depth buffering it will auotmatically do what you want.....

Similar Threads

  1. Color picking with hidden faces?
    By samurle in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 04-14-2013, 02:28 PM
  2. Finding intersection points for half hidden objects
    By Vskrap in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-11-2013, 11:21 AM
  3. how to pick objects with ray cast ?
    By hambelo in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-10-2008, 09:19 AM
  4. How many objects can I pick?
    By bulldog in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-08-2003, 08:01 PM
  5. picking objects
    By billy in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 12-28-2000, 05:32 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