游戏开发论坛

 找回密码
 立即注册
搜索
查看: 3105|回复: 3

出现异常

[复制链接]

14

主题

77

帖子

83

积分

注册会员

Rank: 2

积分
83
发表于 2008-7-11 06:08:00 | 显示全部楼层 |阅读模式
刚学OGRE,没写两句就来了异常,不知道怎么回事?


INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
{
        Root *root = new Root("","");
        root->loadPlugin( "RenderSystem_Direct3D9" );

最后一句出现异常:ogre02.exe 中的 0x76f442eb 处未处理的异常: Microsoft C++ 异常: 内存位置 0x001af2f4 处的ogre::InternalErrorException。
如果我用plugins.cfg而不是用loadPlugin话,倒是没有异常出现。

但是又出现问题:


INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
{
        Root *root = new Root();        //用plugins.cfg

        String rName("OpenGL Rendering Subsystem");
        RenderSystemList *rList = root->getAvailableRenderers();
        RenderSystemList::iterator it = rList->begin();
        RenderSystem *rSys = 0;
        while (it != rList->end())
        {
                rSys = *(it++);
                if (rSys->getName() == rName)
                {
                        root->setRenderSystem(rSys);
                        break;
                }
        }
        if (root->getRenderSystem() == NULL)
        {
                delete root;
                return -1;
        }

        root->initialise( false );

        RenderWindow *window = rSys->createRenderWindow( "test", 800, 600, false, 0 );

        SceneManager *sceneMgr = root->createSceneManager( ST_GENERIC, "mmm" );

        Entity* ent1 = sceneMgr->createEntity( "fff", "athene.mesh" );

最后一句又有异常:ogre02.exe 中的 0x76f442eb 处未处理的异常: Microsoft C++ 异常: 内存位置 0x0022e8b8 处的 Ogre::ItemIdentityException。 [em7]

66

主题

223

帖子

223

积分

中级会员

Rank: 3Rank: 3

积分
223
发表于 2008-7-11 08:24:00 | 显示全部楼层

Re:出现异常

可能是你的RenderSystem的DLL路径没有设置正确才导致的异常.

14

主题

77

帖子

83

积分

注册会员

Rank: 2

积分
83
 楼主| 发表于 2008-7-12 05:51:00 | 显示全部楼层

Re:出现异常

我不太明白

怎么设置RenderSystem的DLL的路径?

14

主题

77

帖子

83

积分

注册会员

Rank: 2

积分
83
 楼主| 发表于 2008-7-16 23:02:00 | 显示全部楼层

Re:出现异常

唉,如果有谁碰到类似问题可能会有用。浪费了我N天才搞明白..[em6]

1.DEBUG版需要载入的插件是"RenderSystem_Direct3D9_d"而不是"RenderSystem_Direct3D9"

2.资源必须载入并初始化才能用。
Entity* ent1 = sceneMgr->createEntity( "fff", "athene.mesh" );
这一句之前,必须把athene.mesh的资源载入才行

例如:
        ResourceGroupManager *resMgr = ResourceGroupManager::getSingletonPtr();       
        resMgr->addResourceLocation( "D:/Program Files/OgreSDK/media/models", "FileSystem", "General" );
        resMgr->addResourceLocation( "D:/Program Files/OgreSDK/media/materials/textures", "FileSystem", "General" );
        resMgr->addResourceLocation( "D:/Program Files/OgreSDK/media/materials/scripts", "FileSystem", "General" );
        resMgr->addResourceLocation( "D:/Program Files/OgreSDK/media/materials/programs", "FileSystem", "General" );
        ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-21 23:52

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表