Re: [osg-users] picking osg objects using osgUtil::SceneView (cant find osgUtil::PickVisitor!)

2008-04-18 Thread Robert Osfield
Hi Erland,

You could use osgViewer::GraphicsWindowEmbedded to replace SceneView,
see the osgviewerGLUT and osgviewerSDL examples.

Robert.

On Thu, Apr 17, 2008 at 10:13 PM,  [EMAIL PROTECTED] wrote:
 Hei Robert.

  I would like to do that, but im working in a company and right now im trying 
 to integrating osg in a existing rendring system (which handles events, mfc 
 window, renders 3d terrain++) for rendering simple objects, so i'd rather use 
 SceneView as for now.

  I think i could be using LineProjector and IntersectVisitor to find 
 intersections..? But havent testet yet. See attachment.

  Erlend




  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Osfield
  Sent: 17. april 2008 22:22
  To: OpenSceneGraph Users
  Subject: Re: [osg-users] picking osg objects using osgUtil::SceneView (cant 
 find osgUtil::PickVisitor!)

  Hi Erland,

  Would it not be possible just to use osgViewer rather than SceneView.
  One of the points of osgViewer is that it provides more higher level
  functionality that users commonly require, and in doing so avoid the
  pain of end users having to implement themselves, and the pain
  involved in trying to communicate all the low level details required
  to teach a 3rd party how to implement something already implemented
  for them.

  Robert.

  On Thu, Apr 17, 2008 at 8:49 PM,  [EMAIL PROTECTED] wrote:
  
  
  
  
   I want to pick osg objects in the scene when pressing the mouse button on
   them.  I am using sceneView so i guess i cant use the osgViewer::View.
   computeIntersections and i
  
   did not find PickVisitor! Im using osg 2.3.7. So i guess i have to use
   IntersectVisitor. Is there a utility function for getting a line from 
 camera
   towards mouse position. Or do i: camera.pos - gluUnproject screen to world
  
  
  
   erlend
   ___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  
  
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


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


Re: [osg-users] picking osg objects using osgUtil::SceneView (cant find osgUtil::PickVisitor!)

2008-04-18 Thread Paul Melis
Looking at that example I see that swapbuffers has to be called manually 
in this case, but I fail to find the place in the source where Viewer 
checks if it is running embedded and therefore doesn't have to call 
swapbuffers itself. Can you give a hint where this is?

Paul

Robert Osfield wrote:

Hi Erland,

You could use osgViewer::GraphicsWindowEmbedded to replace SceneView,
see the osgviewerGLUT and osgviewerSDL examples.

Robert.

On Thu, Apr 17, 2008 at 10:13 PM,  [EMAIL PROTECTED] wrote:
  

Hei Robert.

 I would like to do that, but im working in a company and right now im trying 
 to integrating osg in a existing rendring system (which handles events, mfc 
 window, renders 3d terrain++) for rendering simple objects, so i'd rather 
 use SceneView as for now.

 I think i could be using LineProjector and IntersectVisitor to find 
 intersections..? But havent testet yet. See attachment.

 Erlend




 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Osfield
 Sent: 17. april 2008 22:22
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] picking osg objects using osgUtil::SceneView (cant 
 find osgUtil::PickVisitor!)

 Hi Erland,

 Would it not be possible just to use osgViewer rather than SceneView.
 One of the points of osgViewer is that it provides more higher level
 functionality that users commonly require, and in doing so avoid the
 pain of end users having to implement themselves, and the pain
 involved in trying to communicate all the low level details required
 to teach a 3rd party how to implement something already implemented
 for them.

 Robert.

 On Thu, Apr 17, 2008 at 8:49 PM,  [EMAIL PROTECTED] wrote:
 
 
 
 
  I want to pick osg objects in the scene when pressing the mouse button on
  them.  I am using sceneView so i guess i cant use the osgViewer::View.
  computeIntersections and i
 
  did not find PickVisitor! Im using osg 2.3.7. So i guess i have to use
  IntersectVisitor. Is there a utility function for getting a line from 
  camera
  towards mouse position. Or do i: camera.pos - gluUnproject screen to world
 
 
 
  erlend
  ___
   osg-users mailing list
   osg-users@lists.openscenegraph.org
   http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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




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

  


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


Re: [osg-users] picking osg objects using osgUtil::SceneView (cant find osgUtil::PickVisitor!)

2008-04-18 Thread Robert Osfield
Hi Paul,

On Fri, Apr 18, 2008 at 10:18 AM, Paul Melis [EMAIL PROTECTED] wrote:
 Looking at that example I see that swapbuffers has to be called manually
  in this case, but I fail to find the place in the source where Viewer
  checks if it is running embedded and therefore doesn't have to call
  swapbuffers itself. Can you give a hint where this is?

osgViewer::Viewer/CompositeViewer don't check to see if the graphics
window is an embedded one, they just assume its not, and go ahead and
call makeCurrent and swapBuffers on the graphics window.  In the case
of GraphicsWindowEmbedded these are non ops, since they nothing about
the actual graphics context, only the app does they can't do anything
but non ops.   This does sound like a bit of recipe for disaster...
but, as long as the app is running the viewer with single context and
single threaded and does the makeCurrent and swapBuffers as required
in its own code everything works.

GraphicsWindowEmbedded is really just a an adapter that fools
osgViewer into behaving more like osgUtil::SceneView, just a far more
capable version that supports events, event handlers, camera
manipulators, database paging, all with the same API as the fullblown
osgViewer base apps.  This makes it much simpler to migrate to a full
scalable OSG app just a few code changes in the client app.

On of the key points about osgViewer is the ability to unify a full
range of usage models all within the same set of classes, this makes
providing a consistent set of API and functionality across the usage
range, and make it easier to move between different usage styles, and
for me it makes it easier to maintain, document and support.

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


[osg-users] picking osg objects using osgUtil::SceneView (cant find osgUtil::PickVisitor!)

2008-04-17 Thread erf
I want to pick osg objects in the scene when pressing the mouse button on them. 
 I am using sceneView so i guess i cant use the osgViewer::View. 
computeIntersections and i
did not find PickVisitor! Im using osg 2.3.7. So i guess i have to use 
IntersectVisitor. Is there a utility function for getting a line from camera 
towards mouse position. Or do i: camera.pos - gluUnproject screen to world

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


Re: [osg-users] picking osg objects using osgUtil::SceneView (cant find osgUtil::PickVisitor!)

2008-04-17 Thread Robert Osfield
Hi Erland,

Would it not be possible just to use osgViewer rather than SceneView.
One of the points of osgViewer is that it provides more higher level
functionality that users commonly require, and in doing so avoid the
pain of end users having to implement themselves, and the pain
involved in trying to communicate all the low level details required
to teach a 3rd party how to implement something already implemented
for them.

Robert.

On Thu, Apr 17, 2008 at 8:49 PM,  [EMAIL PROTECTED] wrote:




 I want to pick osg objects in the scene when pressing the mouse button on
 them.  I am using sceneView so i guess i cant use the osgViewer::View.
 computeIntersections and i

 did not find PickVisitor! Im using osg 2.3.7. So i guess i have to use
 IntersectVisitor. Is there a utility function for getting a line from camera
 towards mouse position. Or do i: camera.pos - gluUnproject screen to world



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


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


Re: [osg-users] picking osg objects using osgUtil::SceneView (cant find osgUtil::PickVisitor!)

2008-04-17 Thread erf
Hei Robert.

I would like to do that, but im working in a company and right now im trying to 
integrating osg in a existing rendring system (which handles events, mfc 
window, renders 3d terrain++) for rendering simple objects, so i'd rather use 
SceneView as for now.

I think i could be using LineProjector and IntersectVisitor to find 
intersections..? But havent testet yet. See attachment.

Erlend


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Osfield
Sent: 17. april 2008 22:22
To: OpenSceneGraph Users
Subject: Re: [osg-users] picking osg objects using osgUtil::SceneView (cant 
find osgUtil::PickVisitor!)

Hi Erland,

Would it not be possible just to use osgViewer rather than SceneView.
One of the points of osgViewer is that it provides more higher level
functionality that users commonly require, and in doing so avoid the
pain of end users having to implement themselves, and the pain
involved in trying to communicate all the low level details required
to teach a 3rd party how to implement something already implemented
for them.

Robert.

On Thu, Apr 17, 2008 at 8:49 PM,  [EMAIL PROTECTED] wrote:




 I want to pick osg objects in the scene when pressing the mouse button on
 them.  I am using sceneView so i guess i cant use the osgViewer::View.
 computeIntersections and i

 did not find PickVisitor! Im using osg 2.3.7. So i guess i have to use
 IntersectVisitor. Is there a utility function for getting a line from camera
 towards mouse position. Or do i: camera.pos - gluUnproject screen to world



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


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
osgManipulator::PointerInfo pInfo;
pInfo.setMousePosition(mouse_x, mouse_y);
pInfo.setCamera(_sceneViewer-getCamera());
osg::ref_ptrosgManipulator::LineProjector lineProj = new 
osgManipulator::LineProjector;
osg::Vec3 point;
lineProj-project(pInfo, point);
osg::ref_ptrosg::LineSegment pickLine = new 
osg::LineSegment(lineProj-getLineStart(), lineProj-getLineEnd());

osgUtil::IntersectVisitor visitor;
//visitor.setEyePoint(_sceneViewer-getCamera()-getPosition());
visitor.addLineSegment(pickLine.get());
_root-accept(visitor);
osgUtil::IntersectVisitor::HitList hitList = 
visitor.getHitList(pickLine.get());

 osgUtil::Hit firstHit = hitList.front();
std::string id = firstHit.getDrawable()-getName();___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org