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