由于毕设做的是基于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
再去查了下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路径都改了,如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# Resources required by the sample browser and most samples. [Essential] Zip=../../../../media/packs/SdkTrays.zip Zip=../../../../media/packs/profiler.zip FileSystem=../../../../media/thumbnails # Common sample resources needed by many of the samples. # Rarely used resources should be separately loaded by the # samples which require them. [Popular] FileSystem=../../../../media/fonts FileSystem=../../../../media/materials/programs FileSystem=../../../../media/materials/scripts FileSystem=../../../../media/materials/textures FileSystem=../../../../media/materials/textures/nvidia FileSystem=../../../../media/models FileSystem=../../../../media/particle FileSystem=../../../../media/DeferredShadingMedia FileSystem=../../../../media/PCZAppMedia FileSystem=../../../../media/RTShaderLib FileSystem=../../../../media/RTShaderLib/materials FileSystem=../../../../media/materials/scripts/SSAO FileSystem=../../../../media/materials/textures/SSAO Zip=../../../../media/packs/cubemap.zip Zip=../../../../media/packs/cubemapsJS.zip Zip=../../../../media/packs/dragon.zip Zip=../../../../media/packs/fresneldemo.zip Zip=../../../../media/packs/ogretestmap.zip Zip=../../../../media/packs/ogredance.zip Zip=../../../../media/packs/Sinbad.zip Zip=../../../../media/packs/skybox.zip [General] FileSystem=../../../../media # Materials for visual tests [Tests] FileSystem=../../../../media/../../../../Tests/Media |
再次运行,可以正常运行了,错误也都没了,好吧,第一个简单的Ogre示例就这样跑起来了,这个脑袋看过去有点呆啊。
文章评论