View Full Version : Selection with mouse drag

01-11-2001, 05:11 PM

I am a opengl newbie and i like to be able to select a range of vertices using mouse drag to draw a rectangle bounding the vertices.

Currently, i am using selection to select individual vertices and it is working fine.

thanks for looking into this post and thanks again in advance for the help rendered.


01-12-2001, 12:40 AM
I would also like to do this. I had some dificulty selecting vertices though. I had to change these vertices to crosses formed with lines and then it worked fine. If you find out how do this I would apreciate if you could inform me about this. Thanks.

P.S. Maybe you should post this on the advanced forum.

Kilam Malik
01-12-2001, 02:57 AM
If you want to draw a rectangle on the screen and get all vertices inside this rectangle, do the following:
You got the coordinates x1/y1 and x2/y2 of the rectangle selection. Then you do a gluProject for each 3D-vertex you want to check. The result is the 2D-point on screen for each vertex. Then simply check if it's inside the rectangle.


01-12-2001, 04:01 AM
Is it possible to do this with the select buffer by taking the coordinates at the center of the box and creating a picking matrix for the whole rectangle instead of just a few pixels around the cursor?