Hi,

We have a scenario editor that is able to create and destroy osgViewer::Viewer.
When a Viewer is deleted, its graphic context is closed. All the GL objects
used in this context are deleted.

The osg::View destructor is called after the Viewer destructor (because
osgViewer::Viewer inherits from osg::View). The View deletes its camera.

The osg::Camera holds a GraphicsOperation (osgViewer::Renderer) which
is deleted here. The renderer destructor unref its osgUtil::SceneView(s).

The sceneview owns an osgUtil::StateGraph which is deleted here.

ouch...

When the state graph is deleted (and if OSG has been compiled with
OSGUTIL_RENDERBACKEND_USE_REF_PTR), the state sets and the drawables
collected in the last culling traversal are deleted. The textures
of the state sets are deleted. And they register their GL object name
to be reused. :'(


So, when a new viewer is created with the same context ID (now available),
and the textures of the new scene request a new GL object, OSG try to reuse
a deleted texture object.

In my case, the application crash because :
- a texture is created (the texture object hasn't been reused because
 the match function as failed for all the "to be reused texture objects".
 The GL id of this texture is X. But there is a "to be reused texture
 object" that has an id of X.
- another texture is created. This texture reuse texture object X.
- a texture created to store a depth component (first texture) is used
 to upload RGBA data. :'(   ... crash.

For the moment, I call osg::discardAllDeletedGLObjects(contextID) just
after the viewer destruction. It works.

I'm searching a place in osg or in osgViewer to insert the GL object
discard.

Maybe the best is in GraphicsContext::close (discard if the context
is not shared).

Suggestion ?


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to