Hi Hark, I can't quite work out what you are trying to do with your usage model, it's rather a perplexing thing to want to leverage osgViewer but not want any of the actual rendering and windowing capability and this is really what this library is all about.
If you just want a scene graph and to run an update and event traversal just create your own vistors and do traversal on them, no need for osgViewer at all. If you really didn't want to leverage what osgViewer::Viewer sets but don't want the standard implementation of Viewer::frame() then you don't need to subclass, simply don't call frame(), just call the traversals you want to call from your own frame loop, the Viewer has been designed to allow you to do this, frame() is just their as a convinience function. Robert. On Wed, Apr 13, 2011 at 3:41 PM, Hark Tag <[email protected]> wrote: > Hi everyone, > > This is my first time using the forums, and I have a question that may seem a > little strange. > > My app is using osgViewer, but I am trying to make it so that it does not > actually render onto the screen. I still want to use the infrastructure to > update in the updateTraversal(). So in a sense, I'd like to keep all the back > end parts, but remove the visual front end. > > So far, what I've done is create a new class that inherits from > osgViewer::Viewer. I overloaded the run() and frame() functions such that > they do everything that the original code does EXCEPT call the realize() and > drawTraversal() functions: > > > > Code: > > //overload this function to not call realize() > int run() > { > const char* str = getenv("OSG_RUN_FRAME_COUNT"); > if (str) > { > int runTillFrameNumber = atoi(str); > while (!done() && > getViewerFrameStamp()->getFrameNumber()<runTillFrameNumber) > frame(USE_REFERENCE_TIME); > } > else > { > while (!done()) > frame(USE_REFERENCE_TIME); > } > > return 0; > } > > > //overload this function to not include the draw > void frame(double simulationTime) > { > > if (_done) return; > > if (_firstFrame) > { > viewerInit(); > > _firstFrame = false; > } > advance(simulationTime); > > eventTraversal(); > updateTraversal(); > } > > > > > > When I do this, the application "exits normally" when it reaches the > updateTraversal() method. More specifically, it exits on the line: > > > Code: > getSceneData()->accept(*_updateVisitor); > > > > of that method with the following warning: > > >> Warning: deleting still referenced object 0x827a760 of type >> 'PN3osg10ReferencedE' >> the final reference count was 1, memory corruption possible. > > > > > I definitely want to keep that functionality there so that the infrastructure > is maintained. I am also confused as to why it is exiting as opposed to seg > faulting. > > One of my colleagues suspects that the problem could involve the > GraphicsContexts. He suggested I try creating a null GraphicsContexts that > inherits from GraphicsContexts (which essentially does nothing), but I'm > wondering if there is a far better option than this. > > Any insight on this would be appreciated! Thank you! > > Sincerely, > Hark > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=38442#38442 > > > > > > _______________________________________________ > 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

