Hi Yefei, The set up of threading on various graphics contexts that the viewer is managing is set up in the src/osgViewer/ViewerBase.cpp's ViewerBase::startThreading() method. In this code there is two parts of interest to management of the swap of the graphics contexts.
First up a bit of background - when multithreading each GraphicsContext has a GraphicsThread, and each GraphicsThread has an OperationQueue that contains all the operations to run for that context. The operations to run are set up the Viewer::startThreading() by adding them to the OperationQueue. The key operations added are first the a RunOperation() that dispatches all the rendering of all the cameras attached to the GraphicsContext, then there is a BarrierOperation that is to added after the rendering dispatch to synchronize threads before, then finally the SwapBufferOperation. There is also an option for moving this barrier to after the swap buffer. In you case it sounds like you would like to introduce your own BarrerOperation to do you own syncronization of threads. Unfortunately right now osgViewer hides this in the startThreading() method, but potentially we could tweak he ViewerBase API to allow you to get/set the BarrierOperation, as well as the SwapBufferOperation. There might be a bit of complication in that right now the BarrierOperation has to be constructed with the correct number of threads, which is only 100% known once you're inside the startThread() method, so perhaps a BarrierOperation callback would suffice. Robert. _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

