[osg-users] VBO's - lifetime.

Robert Osfield robert.osfield at gmail.com
Wed Nov 25 06:25:44 PST 2009

Hio Nico,

I've attempted to reproduce the cash using a scene graph that I force
to use VBO's, and the run the viewer for a frame() or run() then
destruct the viewer, then the scene graph - along the lines of your
code fragment, but it runs reliable on my Kubuntu 9.04 64bit system
with svn/trunk.

Here's lies the problem with using code fragments - I just don't know
if it you did something different in your code to what I've put
together and this accounts for the difference we are seeing, or
whether it's just thread timing/unitialized variable/different
OS/different compiler/different rev of the OSG.  Compilable examples
that can be tried on both systems eradicate many of the variables as
to the cause of the problems, I know this is more work, but it's far
quicker for trying to isolate bugs.

Until I can reproduce the problem there isn't too much I can do at my
end.  What I'll now do is look at J.P. example to see if that help
track down one or more of the problems with the VBO clean up.  Whether
any solution to J.P's observed problems will address the one you are
observing I can't say without being able to reproduce your problem.


On Tue, Nov 24, 2009 at 8:18 PM, Nico Kruithof <Nico at nghk.nl> wrote:
> Hello,
> When a node with VBO's enabled outlives the lifetime of it's renderer, I get
> an access violation in GLBufferObjectSet::orphan when I try to destroy the
> node. I tried to write down the scenario:
> using namespace osg;
> ref_ptr<Node> node(new Node);
> ref_ptr<Geometry> geom(new osg::Geometry);
> // ... fill geom
> geom->setUseVertexBufferObjects(true);
> node->addDrawable(geom.get());
> {
>   ref_ptr<osgViewer::Viewer> viewer(new osgViewer::Viewer());
>   viewer->setSceneData(node);
>   viewer->frame();
>   // render for a while
>   viewer = NULL; // The viewer is destroyed here
> }
> node = NULL; // This gives the access violation.
> Now if I don't set "geom->setUseVertexBufferObjects(true);" everything works
> fine. Do you still need a valid render context or a valid viewer to be able
> to clean up the VBO's?
> Nico
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list