Earlier I reported that some of the OSG examples were crashing when running with ThreadPerCamera, there were two issues:
1) Deletion of scene graph objects in the update phase while the graphics thread was still using them. The rendering back end only uses C pointers to the scene graph for performance reasons so can't protect itself against objects being deleted from underneath it. The osgcatch example was crashing due to this. The solution I have deployed is to use a DeleteHandler that catches all attempts to delete objects and retains then for a number of frames before they are finally flushed. This allows the graphics thread to safe use scene graph elements without needing to explicitly reference them. 2) Render to texture cameras where crashing due to them only having one rendering cache pointer per graphics context. This rendering cache was being used to store the RenderStage that was used for storing all the rendering data to drawn in the draw traversal. The problem occurs because the double buffering on SceneView wasn't reflect in the double buffering of the rendering cache - so two separate frames were sharing and working on the same RenderStage at onces. The solution was to use a new data structure that holds map of CullVisitor* to osg::ref_ptr<RenderStage>. This data structure is protected by a mutex and naturally allows for double buffering on demand. With these two changes all the OSG example now run safely with ThreadPerCamera. I haven't yet implemented the multi-threading of cull traversals yet, so ThreadPerCamera isn't yet a true description... Something for this afternoon if I get the chance. Robert. _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
