Results 1 to 3 of 3

Thread: Box selection instead of picking

  1. #1
    Guest

    Box selection instead of picking

    Hello,

    I thought I could use the normal picking procedure to select objects with a rubberband box but this only works if the area is completely covered with objects.
    If I have a part of the area without objects, I get zero hits.

    Is this expected behaviour?
    If so, what can I do to create a rubberband selection?

    Code :
    glu.gluPickMatrix((x0+x)*0.5, (double)(viewport[3]-(y0+y)*0.5),Math.abs(x0-x),Math.abs(y0-y),viewport,0);
    Box diagonal corners (x0,y0) and (x,y)

    Thanks for your feedback
    /Jonas Forssell, Gothenburg, Sweden

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,595

    Re: Box selection instead of picking

    Try something like this instead.

    Code :
    int xsize=Math.abs(x0-x);
    int ysize=Math.abs(y0-y);
    gluPickMatrix( Math.min(x0,x)+xsize/2.0,
     Math.min(y0,y)+ysize/2.0, xsize, ysize);
    I have not tried it but something like that should work, the example above assume that your y values are correct OpenGL values and not standard mouse coordinates.

    (You need to specify the center of the box and the width and height of the box as arguments)

    Mikael

  3. #3
    Guest

    Re: Box selection instead of picking

    Thanks,

    I also found that the buffer was not set high enough so when the selection included too much element, none was selected!

    /Jonas

Similar Threads

  1. help with selection ad picking??
    By Ali in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 06-20-2007, 09:33 PM
  2. Picking (selection)
    By darren in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-16-2003, 08:56 AM
  3. Picking and Selection.
    By Pezdro in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-07-2003, 12:17 PM
  4. Is using selection buffer for selection or picking slow?
    By mohsin in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 04-11-2001, 03:56 AM
  5. selection and picking
    By KlaHyMan in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-16-2000, 02:38 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