gpt4 book ai didi

c++ - 安装Ogre sdk 有问题?

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:39:25 25 4
gpt4 key购买 nike

我是 Ogre 的新手并尝试运行第一个教程,但我遇到了获取错误信息

OGRE EXCEPTION(6:FileNotFoundException): 'resources_d.cfg' file not found! in
ConfigFile::load at ../../OgreMain/src/OgreConfigFile.cpp (line 83)

请帮忙,它很关键!

另一个问题:

cmake对于安装Ogre sdk重要吗?

最佳答案

在使用 cmake 编译/安装 ogre 之后在 Linux 上,这两个配置文件位于

/usr/local/share/OGRE/resources.cfg
/usr/local/share/OGRE/plugins.cfg

只需将两者都导入到您的食人魔项目中一旦安装了 ogre,你的项目就不需要 cmake为了让你继续学习教程:

如何使用 ogre 设置 eclipse:

文件 -> 新建 -> C++ 项目 -> EmptyProject

C/C++ 构建 -> 环境 OGRE_LOC/home/scott/src/ogre_src_v1-7-3

C/C++ 构建 -> 设置

GCC C++ Compiler -> Includes

${OGRE_LOC}/OgreMain/include
/usr/local/include/OGRE
${OGRE_LOC}/Samples/Common/include
/usr/include/OIS

GCC C++ Linker -> Libraries (-l)

OgreMain
OgreTerrain
OIS
CEGUIOgreRenderer

右键单击项目 -> 属性 -> 导入

General -> File System -> 

ONLY import those 4 files from the tutorial project
(NOT dist, build, makefiles ...)

BaseApplication.cpp
BaseApplication.h
TutorialApplication.cpp
TutorialApplication.h

also import these files :

/usr/local/share/OGRE/resources.cfg
/usr/local/share/OGRE/plugins.cfg

现在您可以编译和运行了!

添加一个 Ogre 模型:

首先执行上述步骤创建一个 ogre 项目,确保它编译 OK。执行时它会呈现黑屏 - 没关系。现在要添加一个模型(Ogre),只需编辑 TutorialApplication.cpp,使函数 createScene 显示为:

``

void TutorialApplication::createScene(无效){

Ogre::Entity* ogreHead = mSceneMgr->createEntity("Head", "ogrehead.mesh");

Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
headNode->attachObject(ogreHead);

// Set ambient light
mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));

// Create a light
Ogre::Light* l = mSceneMgr->createLight("MainLight");
l->setPosition(20,80,50);

关于c++ - 安装Ogre sdk 有问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7072171/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com