I resolved this issue by calling OpenThreads::Thread::Init() during program initialization (not sure why the glut example didn't need to do this). My application is now successfully using setUpViewerAsEmbeddedInWindow in combination with wxpython using a rather modified version of Hartmut Seichter's osgBindings swig package.
Thanks- Abe Abe Stephens wrote: > Thanks, I appreciate the help. osgViewer::Viewer produces a segfault in > libOpenThreads: > > #0 0xb5dc577d in OpenThreads::Thread::setProcessorAffinity > (this=0x80d1d78, cpunum=0) > at > > /local/abe/build-piglet/package/OpenSceneGraph/src/OpenThreads/pthreads/PThread.c++:505 > #1 0xb5dc589c in OpenThreads::SetProcessorAffinityOfCurrentThread > (cpunum=0) > at > > /local/abe/build-piglet/package/OpenSceneGraph/src/OpenThreads/pthreads/PThread.c++:922 > #2 0xb4370771 in osgViewer::Viewer::setUpThreading (this=0x88ef878) > at > > /local/abe/build-piglet/package/OpenSceneGraph/src/osgViewer/Viewer.cpp:898 > #3 0xb4370e16 in osgViewer::Viewer::realize (this=0x88ef878) at > > /local/abe/build-piglet/package/OpenSceneGraph/src/osgViewer/Viewer.cpp:1794 > #4 0xb4dada46 in _wrap_Viewer_realize (args=0x87eec4c) at > > /local/abe/build-piglet/package/osgBindings/build-gcc/src/osgViewerPYTHON_wrap.cxx:10607 > > Further inspection of the call stack revealed that when executed via > glut Thread::CurrentThread() on line 919 of PThread.c++ returns zero > while when executed in the wx program returns a bogus pointer. > > The function is invoked as: > > self.viewer = osgViewer.Viewer() > pos = self.GetRect(); > self.viewer.setUpViewerAsEmbeddedInWindow( pos.x, pos.y, pos.width, > pos.height ) > self.viewer.setThreadingModel(osgViewer.Viewer.SingleThreaded) > self.viewer.realize() # Causes segfault above. > > Do you have any idea why this might be the case? I appreciate that this > problem is likely related to an interaction with python, but any advice > would be appreciated. > > -Thanks > Abe > > Robert Osfield wrote: > >> Hi Abe, >> >> I don't know what might be up given your code fragment. SceneView is >> lower level that osgViewer::Viewer, so does require more care with >> setup, and its less powerful.... >> >> Personally I wouldn't recommend using SceneView in your own code, just >> use osgViewer::Viewer and its embedded mode if you need to integrate >> with an existing window. It's a waste of our time to struggle on >> trying to get SceneView do things that Viewer already does out of the >> box perfectly. >> >> Robert. >> >> On 8/30/07, Abe Stephens <[EMAIL PROTECTED]> wrote: >> >> >>> Hi, I'm attempting to load an animated .osg scene exported from blender >>> into an existing application with minimal fuss. The existing application >>> has a basic glut front end and a more useful wxpython front end. I'm >>> having trouble getting animation to work properly: >>> >>> In the glut application using osgViewer::Viewer animation works when >>> I call: >>> >>> viewer->advance() >>> viewer->updateTraversal() >>> viewer->renderingTraversal() >>> >>> However in the wxpython application, using osgUtil::SceneView animation >>> does not work. I am calling: >>> >>> frameStamp = osg.FrameStamp() >>> time = >>> osg.Timer.instance().delta_s(self.start_tick,osg.Timer.instance >>> ().tick()) >>> frameStamp.setReferenceTime(time) >>> frameStamp.setSimulationTime(time) >>> frameStamp.setFrameNumber(self.framecounter) >>> self.framecounter += 1 >>> >>> self.sceneviewer.setFrameStamp( frameStamp ) >>> self.sceneviewer.update() >>> self.sceneviewer.cull() >>> self.sceneviewer.draw() >>> >>> I noticed that unlike osgViewer::Viewer, SceneView::update() does not >>> appear to apply the update visitor to the scene data, only to the >>> camera. >>> >>> Any idea what I am doing wrong? >>> >>> Thanks- >>> Abe >>> >>> >>> >>> _______________________________________________ >>> osg-users mailing list >>> [email protected] >>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >>> >>> >>> >> _______________________________________________ >> osg-users mailing list >> [email protected] >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

