Ogre 1.7中使用多线程

在Ogre 1.7中,对多线程的支持有三个选择:

要在Ogre 1.7中使用多线程:

  1. 在OgreBuildSettings.h改写2行
    1. OGRE_THREAD_SUPPORT 2  // 通过ResourceBackgroundQueue实现。
    2. OGRE_THREAD_PROVIDER 3 // TBB library provides threading functionality

我采用C++的并行编程模板库Threading Building Blocks。采用CMake构造的需要把TBB的文件拷贝到Ogre的Dependence的相关目录下。

Ogre 1.7 的 Threading changes

  • WorkQueue added to accept generalised work items to be executed in background worker threads
  • WorkQueue starts the number of workers based on hardware, or can be told to start a different number
  • Main Ogre WorkQueue is in Root::getWorkQueue. You can also subclass WorkQueue and provide your own if you want
  • ResourceBackgroundQueue now uses WorkQueue instead of using its own queue and can have multiple tasks running at once
  • New focus on data-driven, task-based parallel execution with separation of GPU and CPU activities
  • Boost, POCO and Thread Building Blocks supported as threading back-ends (Boost preferred)
  • All Ogre thread support will use WorkQueue in future

备注:1.7添加了一个Character Sample,其中SinbadCharacterController有参考价值。

 

采用OGRE_THREAD_SUPPORT = 1并不被推荐,而应该使用OGRE_THREAD_SUPPORT = 2。sinbadUsing the new threading scheme说明了原因。更具体的讨论在high performance thread support - request for comments。当前,有Proposal: OGRE_THREAD_SUPPORT == 3,但是没有整合到Ogre 1.7中。

关于多线程参考:多线程的渲染与物理模拟(pdf)和Threading the OGRE3DRender System(pdf)

2010/07/07刷新:关于WorkQueue可以参考OGRE多线程的使

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值