错误积累——OGRE
由于项目比较大,而且是由多人同时完成的。所以,出现错误的时候,快速的找到错误也是提高效率的好方法。
首先查询OGRE日志,默认日志为运行文件夹下 ogre.log 文件。用记事本打开。
文件末尾,错误信息记录如下:
OGRE EXCEPTION(3:RenderingAPIException):
Zero sized texture surface on texture descFontTexture face 0 mipmap 0.
Probably, the GL driver refused to create the texture.
in GLTexture::_createSurfaceList at .\src\OgreGLTexture.cpp (line 406)
找到错误信息位置在 OgreGLTexture.cpp 文件,下406行;
错误代码内容如下:
/// Check for error
if(buf->getWidth()==0 || buf->getHeight()==0 || buf->getDepth()==0)
{
OGRE_EXCEPT(
Exception::ERR_RENDERINGAPI_ERROR,
"Zero sized texture surface on texture "+getName()+
" face "+StringConverter::toString(face)+
" mipmap "+StringConverter::toString(mip)+
". Probably, the GL driver refused to create the texture.",
"GLTexture::_createSurfaceList");
}
所以,错误信息的意思大致为:
——首先说明纹理表面大小为零。
——其次是哪个纹理? 纹理名字为 getName() ,所以对于位置的 egTestTexture 就是纹理名称。
——在我们测程序中查找 egTestTexture ,就是错误所在。
——我的程序中没找到 egTestTexture,我缩短字段,找到了唯一的 egTest,它为Ogre::Font 的对象,
日志里面的倒数第二个错误就是关于Ogre::Font载入错误的信息。具体信息如下:
……
17:39:20: Info: Freetype returned null for character 40866 in font descFont
17:39:20: Info: Freetype returned null for character 40867 in font descFont
17:39:20: Info: Freetype returned null for character 40868 in font descFont
17:39:20: Info: Freetype returned null for character 40869 in font descFont
……
所以,我猜测是这个Ogre::Font对象 egTes 需要载入纹理时发生的错误。具体的还要研究Ogre::Font的源代码。
目前,我先将相关代码注释掉,编译,运行。通过了。
到这里我找出了错误。至于修改错误就告诉相关人员去修改。