|
|
以下为PRO OGRE 3D PROGRAMMING书中的代码示例,因为用的是新的SDK,所以创建Timer的部分改了,
Timer *timer = new Timer();
我的机器跑这个程序,一闪而过,大概不足一秒,不知为何,新学Ogre求指点,那个帧监听的示例跑起来是对的。
// Run the manual render loop. Since we are not using a frame listener in this case, we
// will count to 15 seconds and then instead of exiting, we'll change the render window settings
// and re-initialize it.
bool renderLoop = true;
Timer *timer = new Timer();
timer->reset();
float s = 0.0f;
while (renderLoop && window->isActive()) {
renderLoop = root->renderOneFrame();
// accumulate total elapsed time
s += (float)timer->getMilliseconds() / 1000.0f;
// if greater than 15 seconds, break out of the loop
if (s >= 15.0f)
renderLoop = false;
// we must call the windowing system's message pump each frame to
// allow Ogre to process messages
//PlatformManager::getSingleton().messagePump();
//Ogre::WindowEventUtilities::messagePump();
} |
|