Re: [osg-users] Deleting still referenced object

2019-01-16 Thread Richard Harrison

On 15/01/2019 09:03, Robert Osfield wrote:


illustrated it well) and I'm currently flying one of my long test routes.

Fingers and toes crossed.


..and alas after 30h I've got a similar looking problem; the pattern is 
the same i.e. DatabasePager loading something whilst ObjectCache is 
expiring.


This time it's a segfault in the DatabasePager during a copy of a model 
that has just been loaded (simgear, SGReaderWriterXML.cxx:342)


    options->setDatabasePath(texturepath.local8BitStr());
    osgDB::ReaderWriter::ReadResult modelResult;
    modelResult = osgDB::readRefNodeFile(modelpath.local8BitStr(), 
options.get());

    if (!modelResult.validNode())
    throw sg_io_exception("Failed to load 3D model:" + 
modelResult.message(),

  modelpath);
>   model = copyModel(modelResult.getNode());

The object currently being expired in the ObjectCache doesn't seem to 
bear any relation to the model being loaded; one is a windsock and the 
other a radio tower.


This is after I changed all of the osg::getSomething into 
osg::getRefSomething.


I'm now a little confused as I was sure that the fix would work; I've 
kept the debug session open in case there is anything that I need to 
inspect.



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


[osg-users] First recipe from cookbook won't compile with given source code

2019-01-16 Thread Rodrigo Dias
Hi,

I'm following the OpenSceneGraph 3 Cookbook 
(http://ahux.narod.ru/olderfiles/1/OSG3_Cookbook.pdf) to learn more about OSG. 
So I created a directory Cookbook following the directory structure from the 
source code here (https://github.com/xarray/osgRecipes/tree/master/cookbook).

Before compiling the first recipe, I had copied the "Common Functions" from the 
textbook (pages 38-39), into a file called "CommonFunctions". When compiling 
(with g++ on Linux) I got the following error:


> $ g++ observer_ptr.cpp -I../.. -losg -losgDB -losgGA -losgText -losgUtil 
> -losgViewer -o observer_ptr
> 
> In file included from observer_ptr.cpp:11:0:
> ../../CommonFunctions: In member function ‘virtual bool 
> osgCookBook::PickHandler::handle(const osgGA::GUIEventAdapter&, 
> osgGA::GUIActionAdapter&)’:
> ../../CommonFunctions:47:62: error: binding ‘const 
> osgUtil::LineSegmentIntersector::Intersection’ to reference of type 
> ‘osgUtil::LineSegmentIntersector::Intersection&’ discards qualifiers
>   osgUtil::LineSegmentIntersector::Intersection& result = 
> *(intersector->getIntersections().begin());
> 


../.. is the path to the CommonFunctions file. I tried a few const_cast 
operations, but I don't have so much experience with C++ and couldn't solve it. 
I commented out this two lines and the program compiled fine and ran, though 
clicking on the objects wouldn't dismiss them (guess that's what these lines 
do).

Then I noticed they have this "CommonFunctions" file together with the given 
source code, so I replaced mine with theirs (CommonFunctions and 
CommonFunctions.cpp). But when compiling, a new error:


> $ g++ observer_ptr.cpp -I../.. -losg -losgDB -losgGA -losgText -losgUtil 
> -losgViewer -o observer_ptr
> 
> /tmp/cca0xsAB.o: In function `main':
> observer_ptr.cpp:(.text+0x79): undefined reference to 
> `osgCookBook::createText(osg::Vec3f const&, std::__cxx11::basic_string std::char_traits, std::allocator > const&, float)'
> observer_ptr.cpp:(.text+0x103): undefined reference to 
> `osgCookBook::createHUDCamera(double, double, double, double)'
> /tmp/cca0xsAB.o:(.data.rel.ro._ZTV18RemoveShapeHandler[_ZTV18RemoveShapeHandler]+0xb8):
>  undefined reference to 
> `osgCookBook::PickHandler::handle(osgGA::GUIEventAdapter const&, 
> osgGA::GUIActionAdapter&)'
> /tmp/cca0xsAB.o:(.data.rel.ro._ZTC18RemoveShapeHandler0_N11osgCookBook11PickHandlerE[_ZTV18RemoveShapeHandler]+0x18):
>  undefined reference to `typeinfo for osgCookBook::PickHandler'
> /tmp/cca0xsAB.o:(.data.rel.ro._ZTC18RemoveShapeHandler0_N11osgCookBook11PickHandlerE[_ZTV18RemoveShapeHandler]+0xb8):
>  undefined reference to 
> `osgCookBook::PickHandler::handle(osgGA::GUIEventAdapter const&, 
> osgGA::GUIActionAdapter&)'
> /tmp/cca0xsAB.o:(.data.rel.ro._ZTC18RemoveShapeHandler0_N11osgCookBook11PickHandlerE[_ZTV18RemoveShapeHandler]+0xe0):
>  undefined reference to `typeinfo for osgCookBook::PickHandler'
> /tmp/cca0xsAB.o:(.data.rel.ro._ZTC18RemoveShapeHandler0_N11osgCookBook11PickHandlerE[_ZTV18RemoveShapeHandler]+0x218):
>  undefined reference to `typeinfo for osgCookBook::PickHandler'
> /tmp/cca0xsAB.o:(.data.rel.ro._ZTC18RemoveShapeHandler0_N11osgCookBook11PickHandlerE[_ZTV18RemoveShapeHandler]+0x428):
>  undefined reference to `typeinfo for osgCookBook::PickHandler'
> /tmp/cca0xsAB.o:(.data.rel.ro._ZTI18RemoveShapeHandler[_ZTI18RemoveShapeHandler]+0x10):
>  undefined reference to `typeinfo for osgCookBook::PickHandler'
> collect2: error: ld returned 1 exit status
> 


Can anybody please tell me what am I doing wrong?

Thank you!

Cheers,
Rodrigo

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





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


Re: [osg-users] [3rdparty] Use PNG as texture for terrain in osgEarth

2019-01-16 Thread Rodrigo Dias
Thank you, Glenn, but this part was already solved.

About sending the camera's coordinates to screen text, I've found a solution 
elsewhere:


Code:
Vec3f eye;
while ( !viewer.done() ) {
eye = viewer.getCamera()->getInverseViewMatrix().getTrans();
text1->setText((L"Heading: " + to_wstring(eye.x())).c_str());
text2->setText((L"Pitch: " +   to_wstring(eye.y())).c_str());
text3->setText((L"Roll: " +to_wstring(eye.z())).c_str());
viewer.frame();
}




or


Code:
Vec3f eye, center, up;
while ( !viewer.done() ) {
viewer.getCamera()->getViewMatrixAsLookAt( eye, center, up );
text1->setText((L"Heading: " + to_wstring(eye.x())).c_str());
text2->setText((L"Pitch: " +   to_wstring(eye.y())).c_str());
text3->setText((L"Roll: " +to_wstring(eye.z())).c_str());
viewer.frame();
}




Now the numbers change as I move the scene around using TrackballManipulator. 
However, the keys don't change any number when I use FirstPersonManipulator. I 
tried to look at the source code for examples:


> grep -nrw . -e 'FirstPersonManipulator' --include=*.cpp


but this only returns lines from osgGA/FirstPersonManipulator.cpp

How can I know how to use FirstPersonManipulator without a program that uses it?

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





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