[osg-users] Rubber window for multiple selection

51 views
Skip to first unread message

Sonya Blade

unread,
Jul 2, 2014, 2:19:39 AM7/2/14
to osg-...@lists.openscenegraph.org
Dear All,

Mainly I have 2 questions, both are to achieve the comprehensive selection task in OSG.

#1 - How to draw a rectangle, polygonal, circle, lasso etc.. selection rubber?
#2 - How to configure OSG to implement that selection defined at the first step?

For selection part OSG Beginners book suggest to use osgUtil::PolytopeIntersector for regional selection, 
but doesn't give any clue on how to draw the rubber or is it comes as an intrinsic feature of 
sgUtil::PolytopeIntersector when you create it with WINDOW parameter set on. 

I also studied the osgkeyboardmouse.cpp example, but I couldn't find any visible difference when I switch 
from LineSegmentInteresect to PolytopeIntersector, while I was expecting to see the HUD window rubber 
to be drawn and objects falling into that rectangle to be selected.

Your guidance will be appreciated!

Regards,

Sergey Kurdakov

unread,
Jul 2, 2014, 3:03:51 AM7/2/14
to OpenSceneGraph Users
Hi Sonya,

if I'm not mistaken Enviro in vtp ( osg based app ) has rubber band implemented

https://code.google.com/p/vtp/

Regards
Sergey


_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Sonya Blade

unread,
Jul 2, 2014, 5:32:43 AM7/2/14
to OpenSceneGraph Users, sergey...@gmail.com
Hi Sergey,

It really is very hard to locate the code portion where it implements the rubber 
drawing, I'm paving my way with osgHUD example to create the rubber banding.

Your comments will be appreciated,

Regards,

Date: Wed, 2 Jul 2014 11:03:47 +0400
From: sergey...@gmail.com
To: osg-...@lists.openscenegraph.org
Subject: Re: [osg-users] Rubber window for multiple selection

Sergey Kurdakov

unread,
Jul 2, 2014, 5:44:36 AM7/2/14
to Sonya Blade, OpenSceneGraph Users
Hi Sonya,

it is in Enviro.cpp there, see function -

void Enviro::SetWindowBox(const IPoint2 &p1, const IPoint2 &p2)

and also look at track of mouse movements see for MM_SELECTBOX in that file.

basically the approach is to render quad ( with border or without ), keep track of mouse and resize this quad accordingly

rubber band is based on  common approach ( you might look for C++ rubber bands in google ), and only osg one is to appropriately render  selection quad, other tricks are non osg related.

Regards
Sergey
Reply all
Reply to author
Forward
0 new messages