【问题标题】:OGRE EXCEPTION(7:InternalErrorException): Error decoding image in FreeImageCodec::decode atOGRE EXCEPTION(7:InternalErrorException):在 FreeImageCodec::decode 中解码图像时出错
【发布时间】:2015-07-07 05:00:34
【问题描述】:

我正在使用 Ogre 3D 1.9,我正在尝试加载包含在 resource.cfg 文件指向的文件夹中的网格。该文件夹包含子文件夹,用于分隔 .mesh 文件、.material 文件和纹理。以下是 resource.cfg 文件的内容:

# Resources required by the sample browser and most samples.
[Essential]


# Resource locations to be added to the default path
[General]
FileSystem=media
FileSystem=media/materials/scripts
FileSystem=media/materials/textures
FileSystem=media/models

在此之后,我使用以下内容声明并初始化网格、材质和纹理:

Ogre::ResourceGroupManager::getSingleton().declareResource("ram.mesh", "Mesh", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::NameValuePairList());
Ogre::ResourceGroupManager::getSingleton().declareResource("char_ram_col.png", "Font", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::NameValuePairList());
Ogre::ResourceGroupManager::getSingleton().declareResource("char_ram_nor.png", "Font", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::NameValuePairList());
Ogre::ResourceGroupManager::getSingleton().declareResource("ram_skin.material", "Material", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::NameValuePairList());
Ogre::ResourceGroupManager::getSingleton().declareResource("ram_skin_eyelids.material", "Material", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::NameValuePairList());
Ogre::ResourceGroupManager::getSingleton().declareResource("ram_skin_eyes.material", "Material", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::NameValuePairList());
Ogre::ResourceGroupManager::getSingleton().declareResource("ram_skin_horns.material", "Material", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::NameValuePairList());

Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

然后我将网格附加到一个节点:

Ogre::Entity *entity = scene->createEntity("LocalMesh_Ent", "ram.mesh");
Ogre::SceneNode *cube = node->createChildSceneNode("ram.mesh", Ogre::Vector3(x, y, z));
cube->attachObject(entity);

其中 cube 是之前创建的 SceneNode。

我在加载纹理时遇到问题。代码构建没有任何问题,但是当我运行它时出现以下错误(在日志文件中):

OGRE EXCEPTION(7:InternalErrorException): Error decoding image in FreeImageCodec::decode at ..\..\..\..\OgreMain\src\OgreFreeImageCodec.cpp (line 419)

网格和材质创建正确,例如,如果我评论有关纹理的部分。

有谁知道可能是哪个问题?

第二个问题:我读到 .png 文件必须声明为 Font,但还有 Texture 选项(也不起作用)。对吗?

【问题讨论】:

    标签: c++ opengl 3d textures ogre


    【解决方案1】:

    其实我发现了问题。包含纹理的 .png 文件实际上并不是真正的 .png 文件。打开它并用 Gimp 重新保存它解决了我的问题。

    我花了一段时间才解决这个问题,因为文件没有损坏,考虑到我可以使用图像查看器毫无问题地打开它。

    我不知道是什么导致了这种问题,考虑到我刚刚从互联网上下载了一个 Blender 模型,并保存为 Mesh 文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-11
      相关资源
      最近更新 更多