首页 > 编程之美 > Ogre学习笔记(1)
2014
03-03

Ogre学习笔记(1)

由于毕设做的是基于Ogre的虚拟漫游系统,所以最近在很努力地学习Ogre知识。

刚才使用 Ogre AppWizard创建Ogre向导后,在vs2010下可以编译运行,但是在项目debug文件下运行时提示缺少.dll文件,去Ogre wiki上查了下,是这样说的:
Missing a Configuration File or DLLs
If you try to launch your freshly built application but the program complains of missing DLLs or configuration files (*.cfg), then you probably did not copy them over from the OgreSDK folder. In Visual Studios, when you build your application in release mode, it puts the release executable in the [ProjectFolder]\bin\release folder, and the debug executable in the [ProjectFolder]\bin\debug folder. You must copy all the “.dll” and “.cfg” files over from the OgreSDK into the appropriate folders. That is, copy the files from [OgreSDK]\bin\release to [ProjectFolder]\bin\release and [OgreSDK]\bin\debug to [ProjectFolder]\bin\debug. You will also need to edit the resources.cfg file to point at the correct paths. See the next section for more information on this.
也就是需要把[OgreSDK]\bin\debug下的全部文件都要拷贝到项目文件夹的debug下面,我按这说了,拷了过去,点击.exe文件,可是却提示:Unable to read zip file

Ogre学习笔记(1) - 第1张  | Jianchihu

再去查了下wiki,这样说的:
Make sure you have a plugins.cfg and a resources.cfg in the same directory as the executable. Plugins.cfg tells OGRE which rendering libraries are available (Direct3D9, OpenGL, etc). Resources.cfg is used by the ExampleApplication and specifies paths to textures, meshes and scripts. Both are text files, so edit them and make sure the paths are correct. Otherwise your OGRE setup dialog box may not have any rendering libraries in it, or you may receive an error on your screen or in Ogre.log that looks something like this:
Description: ../../Media/packs/OgreCore.zip – error whilst opening archive: Unable to read zip file

也就是需要把Resources.cfg中的路径配置改了,我把media文件夹都拷贝过来,media文件夹位置:D:\vs 2010\Projects\media,项目debug位置:D:\vs 2010\Projects\OgreApp4\OgreApp4\bin\Debug,设置好media文件夹相对于可执行文件的相对路径,
把Resources.cfg中media路径都改了,如下所示:

再次运行,可以正常运行了,错误也都没了,好吧,第一个简单的Ogre示例就这样跑起来了,这个脑袋看过去有点呆啊。

Ogre学习笔记(1) - 第2张  | Jianchihu

最后编辑:
作者:Jianchihu
管理员——低调做事,低调做人

留下一个回复

你的email不会被公开。

This site uses Akismet to reduce spam. Learn how your comment data is processed.