[英]Assertion Failed error for Ogre RenderWindow
我正在嘗試使用以下網址提供的代碼將Ogre嵌入Qt: https : //github.com/gklingler/QOgreWidget
而且它在我的系統上運行正常,沒有任何問題,但是當我嘗試在Qt應用程序中添加相同代碼時,出現以下錯誤:
SceneManagerFactory for type 'PCZSceneManager' registered.
MovableObjectFactory for type 'PCZLight' registered.
MovableObjectFactory for type 'Portal' registered.
MovableObjectFactory for type 'AntiPortal' registered.
PCZone Factory Type 'ZoneType_Octree' registered
SceneManagerFactory for type 'OctreeSceneManager' registered.
app: ../app/ogre/ogrebasewidget.cpp:45: OgreBaseWidget::OgreBaseWidget(Ogre::Root*, OgreEventHandler*, QWidget*): Assertion `ogreWinId' failed.
The program has unexpectedly finished.
錯誤指向以下代碼段:
Ogre::String winHandle;
winHandle = Ogre::StringConverter::toString((unsigned long) (QX11Info::display()));
winHandle += " : ";
winHandle = Ogre::StringConverter::toString((unsigned long) (QX11Info::appScreen()));
winHandle += " : ";
winHandle = Ogre::StringConverter::toString((unsigned long) (winId()));
Ogre::NameValuePairList params;
params["parentWindowHandle"] = winHandle;
params["FSAA"] = Ogre::String("8");
int w = width();
int h = height();
mOgreRenderWindow = mOgreRoot->createRenderWindow("OgreWidget_RenderWindow",
qMax(w, 640),
qMax(h, 480),
false, ¶ms);
mOgreRenderWindow->setActive(true);
mOgreRenderWindow->setVisible(true);
WId ogreWinId = 0x0;
mOgreRenderWindow->getCustomAttribute("WINDOW", &ogreWinId);
assert(ogreWinId);
QWidget::create(ogreWinId);
setAttribute(Qt::WA_OpaquePaintEvent);
我已經在標題中包含了<cassert>
。 幫我弄清楚。 :(
我找到了給出此錯誤的原因。 我安裝了較舊的Ogre版本(1.7.4)以及較新的1.9版本。
因此,我從系統中清除了這個較舊的版本,瞧,它的工作就像一個魅力。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.