|
描述:
在osgText的例子中,有如下操作
生成线程, 加入操作,
在viewer.addUpdateOperation(updateOperation.get()) 加入操作,在每一帧同步。
问题:
1 这样为什么可以在线程里同步呢?
2 这样做的话,UpdateTextOperation()的操作时在viewer的线程执行的还是在operationThread线程里执行的?
请各位大神回答。
- // create the background thread
- osg::OperationThread* operationThread = new osg::OperationThread;
- // create the operation that will run in the background and
- // sync once per frame with the main viewer loop.
- updateOperation = new UpdateTextOperation(center, diameter, textGroup);
- // // add the operation to the operation thread and start it.
- operationThread->add(updateOperation.get());
- operationThread->startThread();
- // add the operation to the viewer to sync once per frame.
- viewer.addUpdateOperation(updateOperation.get());
复制代码 |
|