RubberBand Selections

Hi Folks,

  I have got a polygon mesh geometry with vertices as cubes. I was able to pick any particular vertex and translate the cube.

I need to implement rubber band selections on it now. How to set the selection process to indentify the cubes falling under my mouse dragged rubberband.


As you know the selection process renders to a frustum. Right now you will (if using selection buffer rendering), be specifying a small frustum around the mouse position based on the window frustum and interpolation +/- some small selection size.

To extend this to rubber banding what you must do is adjust the selection rendering frustum to encompass the extents of the mouse rubber band drag. So, the mouse press defines one corner of the frustum which you can calculate through interpolation. Subsequent mouse moves update the opposite frustum corner, leaving you with a frustum you can render the scene to and fill the selection buffer with hits. Watch out for zero width & height frusta.

You can render to the selection buffer each mouse move and render the rubber band also, how you update the window is up to you, a save & restore of the image would work, you could also render highlighted vertices as they are selected.

The least work would be to perform the selection render only on a mouse release which defines the opposite frustum corner, that’s not as cool though.

Thank you Dobrie, I think i can do this one now.

I have got one more small question which i have posted as "problems with arbitary rotations " in math and and algorithms group. But no one seems to reply me …
Can you have a look at it and tell me how to proceed.

Thanks :slight_smile: Any way for you valuble advise