查看: 1223|回复: 1

osgExample中osgText的同步线程操作

[复制链接]

该用户从未签到

发表于 2013-1-7 20:40:20 | 显示全部楼层 |阅读模式
描述:

在osgText的例子中,有如下操作
   
   生成线程, 加入操作,
   在viewer.addUpdateOperation(updateOperation.get()) 加入操作,在每一帧同步。

问题:
1 这样为什么可以在线程里同步呢?

2 这样做的话,UpdateTextOperation()的操作时在viewer的线程执行的还是在operationThread线程里执行的?

请各位大神回答。

  1.          // create the background thread
  2.            osg::OperationThread* operationThread = new osg::OperationThread;

  3.       // create the operation that will run in the background and
  4.          // sync once per frame with the main viewer loop.
  5.            updateOperation = new UpdateTextOperation(center, diameter, textGroup);

  6.     //        // add the operation to the operation thread and start it.
  7.          operationThread->add(updateOperation.get());
  8.             operationThread->startThread();

  9.        // add the operation to the viewer to sync once per frame.
  10.          viewer.addUpdateOperation(updateOperation.get());
复制代码

该用户从未签到

发表于 2013-1-8 07:53:08 | 显示全部楼层
update 是在viewer的线程中执行,load是在新开的线程中执行,新开的线程的作用就是load
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表