PDA

View Full Version : Selection with mouse drag



01-11-2001, 06:11 PM
hi!

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.

regards
patric

billy
01-12-2001, 01: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, 03: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.


Kilam.

chennes
01-12-2001, 05: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?

Chris