游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1887|回复: 1

在试Ogre手动挡时遇到的问题

[复制链接]

30

主题

227

帖子

232

积分

中级会员

Rank: 3Rank: 3

积分
232
发表于 2009-2-23 17:35:00 | 显示全部楼层 |阅读模式
以下为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();
                }

30

主题

227

帖子

232

积分

中级会员

Rank: 3Rank: 3

积分
232
 楼主| 发表于 2009-2-23 18:07:00 | 显示全部楼层

Re:在试Ogre手动挡时遇到的问题

汗死,已解决。书中源代码有误,应为
s = (float)timer->getMilliseconds() / 1000.0f;
看了API就知道了。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-20 06:54

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表