Re: [osg-users] viewer-getCameraWithFocus() is gone?

2013-09-17 Thread David Zaadstra
Hi,

I think I have resolved the problem in the mean time. IIRC the problem was that 
I was picking during regular mouse events (not the osg ones) which could happen 
any time during traversals. I believe I fixed it with a mutex around frame() 
and the picking. That might be suboptimal with regards to performance, but 
would have been difficult to do in another way due to our framework.
 
Cheers,
David

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56375#56375





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


Re: [osg-users] viewer-getCameraWithFocus() is gone?

2013-09-12 Thread David Zaadstra
Hi,

I had the same question and considered myself lucky to find this solution so 
quickly, but I have a problem:

Sporadically, my application crashes in the std::vector code with vector 
iterator not dereferencable. This happens in the call to back().

Actually I would think that this crash can't happen because I copied your code 
including the empty() query which should ensure that back() works. The only 
difference in my code is that I had to add .get(), but I don't think that makes 
a difference.

Do you have any idea why this could crash? I'd guess it's some kind of 
multithreading issue. Is there anything in osg I should be worrying about here?

Thanks and Regards,
David

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=55935#55935





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


Re: [osg-users] viewer-getCameraWithFocus() is gone?

2013-09-12 Thread Robert Osfield
Hi David,

Given the details it's not possible to know what might be going wrong.  You
are the person best placed to dig into the code and run it in a debugger to
see what is happening.  It could be a threading issue, but really can't say
with just small code segments to work with.  Try running the application
SingleTheaded to see if it makes any difference.

Also if you are accessing any data structures try copying them or taking a
ref_ptr to them before you start working on them, perhaps the data
structure is be deleted by another thread.

Robert.





On 21 August 2013 15:23, David Zaadstra
david.zaads...@telespazio-vega.dewrote:

 Hi,

 I had the same question and considered myself lucky to find this solution
 so quickly, but I have a problem:

 Sporadically, my application crashes in the std::vector code with vector
 iterator not dereferencable. This happens in the call to back().

 Actually I would think that this crash can't happen because I copied your
 code including the empty() query which should ensure that back() works. The
 only difference in my code is that I had to add .get(), but I don't think
 that makes a difference.

 Do you have any idea why this could crash? I'd guess it's some kind of
 multithreading issue. Is there anything in osg I should be worrying about
 here?

 Thanks and Regards,
 David

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=55935#55935





 ___
 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] viewer-getCameraWithFocus() is gone?

2013-08-06 Thread Anders Backman
What is the appropriate call for achieving the same thing now with OSG
3.2.0 when the method Viewer::getCameraFocus is gone?

/Anders



-- 
__
Anders Backman, HPC2N
90187 Umeå University, Sweden
and...@cs.umu.se http://www.hpc2n.umu.se
Cell: +46-70-392 64 67
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] viewer-getCameraWithFocus() is gone?

2013-08-06 Thread Robert Osfield
Hi Anders,

On 6 August 2013 07:57, Anders Backman ande...@cs.umu.se wrote:
 What is the appropriate call for achieving the same thing now with OSG 3.2.0
 when the method Viewer::getCameraFocus is gone?

I have added information about which camera the event is over to the
osgGA::GUIEventAdapter, it now has a PointerData stack, the topmost
entry will be the one with the focus, and it's PointerData.object
member variable will store the pointer to the Camera.  This new scheme
can handle situations where you have distortion correction or other
RTT techniques being deployed in the Viewer.

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


Re: [osg-users] viewer-getCameraWithFocus() is gone?

2013-08-06 Thread Anders Backman
So you cannot find this out through a pointer to the viewer? You need to go
through the EventAdapter?

/A


On Tue, Aug 6, 2013 at 10:20 AM, Robert Osfield robert.osfi...@gmail.comwrote:

 Hi Anders,

 On 6 August 2013 07:57, Anders Backman ande...@cs.umu.se wrote:
  What is the appropriate call for achieving the same thing now with OSG
 3.2.0
  when the method Viewer::getCameraFocus is gone?

 I have added information about which camera the event is over to the
 osgGA::GUIEventAdapter, it now has a PointerData stack, the topmost
 entry will be the one with the focus, and it's PointerData.object
 member variable will store the pointer to the Camera.  This new scheme
 can handle situations where you have distortion correction or other
 RTT techniques being deployed in the Viewer.

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




-- 
__
Anders Backman, HPC2N
90187 Umeå University, Sweden
and...@cs.umu.se http://www.hpc2n.umu.se
Cell: +46-70-392 64 67
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] viewer-getCameraWithFocus() is gone?

2013-08-06 Thread Robert Osfield
Hi Anders,

On 6 August 2013 09:40, Anders Backman ande...@cs.umu.se wrote:
 So you cannot find this out through a pointer to the viewer? You need to go
 through the EventAdapter?

You can get the last event via the osgViewer::View::getEventQueue() method, i.e.

 osgGA::GUIEventAdapt::PointerDataList pdl =
viewer.getEventQueue()-getCurrentEventState()-getPointerDataList();
 if (!pdl.empty())
 {
Camera* camera = dynamic_castosg::Camera*(pdl.back()-object);
 }

If you are handling events then the event itself will have all this
information.  I realize the new scheme is more complicated but it's
much more flexible and robust at handling sophisticated camera setups.

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