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


[osg-users] "Isolation" view using override and protected StateSets

2013-09-12 Thread David Zaadstra
Hi everyone,

I have implemented an isolation view (i.e. show only a selection of nodes, and 
render the other ones transparent) by creating one node above the root that 
contains an override StateSet which sets all nodes transparent and then 
creating "exception" nodes which have override _and_ protected set to "protect" 
the isolated geodes. And for reverting the isolation I simply remove those 
in-between nodes again.

First of all: Is this a good approach? Or do you have a better one? (My goal 
was to not modify existing nodes, so that I don't need to remember and restore 
a previous state. The way it is now I can just check if there are nodes 
matching a certain naming pattern "*-ISOLATE" and remove those)

But my actual problem is: 
For some reason the isolated geode changes its color minimally. In normal view 
it is 24,23,24, and in isolated view it's 22,21,22.
That color change is definitely not caused by the top-level override. So it 
must be caused by the protection which I do like this:


Code:

osg::StateSet * stateSet = new osg::StateSet(*(node->getOrCreateStateSet()));
stateSet->setAttributeAndModes(dynamic_cast(stateSet->getAttribute(osg::StateAttribute::MATERIAL)),
 osg::StateAttribute::OVERRIDE | osg::StateAttribute::PROTECTED);
parentNode->setStateSet(stateSet);




So basically I just take the material of the node that should stay visible, 
copy it to the parent node and set it to protected. I don't see why this 
changes the color. Please help.

Thanks in advance[/code]

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





___
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