내 앱은 Ogre에서 구동되는 게임 세계이고 QT를 사용하여 구현 된 GUI 모듈 인 두 개의 모듈로 나뉩니다.Ogre에서 Qt 윈도우를 지정할 때 CreateRenderWindow()가 충돌했습니다.
응용 프로그램 시작시 간단히 QApplication 인스턴스와 빈 QWindow를 만든 다음 QWindow를 위젯에 넣습니다. 이 같은 코드의 모양을
```
QApplication qapp(argc, argv);
// The class gameworld_widget is just a subclass of QWindow with no other content
ui::gameworld_widget *mainWnd = new ui::gameworld_widget;
QWidget mainWndContainer;
mainWndContainer.setObjectName("OGRE222");
mainWndContainer.resize(800, 600);
mainWndContainer.createWindowContainer(mainWnd);
mainWndContainer.show();
```
가 그럼 난 다른 오우거 모듈을 만들고 initilize 다른 스레드를 생성하고 결국 내가 Qt는에 'mainthread'제어를 전달 .
```
// Get HWND of gameworld_widget in 'main thread'
auto hMainWnd = reinterpret_cast<HWND>(mainWnd->winId());
std::thread gameWorldThread([hMainWnd]() {
try {
game_world gameWorld(hMainWnd); // see below
}
catch (game_world_exception &ex) {
std::cout << "GameWorldException occurs\n";
return;
}
});
gameWorldThread.detach(); // detach Ogre thread
return qapp.exec(); // pass control to Qt
오우거 모듈에서
```
,이 같은 내 코드 조회 :
```
Ogre::NameValuePairList params;
params["externalWindowHandle"] = Ogre::StringConverter::toString(reinterpret_cast<size_t>(hwnd));
Ogre::RenderWindow *mWindow;
try
{
mWindow = root.createRenderWindow("SampleBrowser", 800, 600, false, ¶ms);
}
catch (Ogre::Exception ex)
{
std::cout << "Ogre exception occur:" << typeid(ex).name() << ex.what() << "\n";
throw game_world_exception();
}
catch (...)
{
throw game_world_exception(); // comment goes here
}
```
여기에 질문이 왔습니다. 에스.
을 실행할 때```/* comment goes here */
mWindow = root.createRenderWindow("SampleBrowser", 800, 600, false, ¶ms);
```
내 앱이 추락, 나는 심지어 예외를 잡을 수 없습니다. (나는 중국어이므로 언어는 중국어 ...) 진행률 표시 줄의 내용은 'Ogre2.exe가 작동을 멈췄습니다 ... Windows가 문제를 찾는 중입니다' 제 시스템은 Windows 10이고 IDE는 Visual Studio입니다 Ogre는 1.8 버전이고 Qt는 5.7.0입니다. 선택된 Ogre Render 시스템이 OpenGL입니다.
메인 스레드에서 수행하지만 여전히 끔찍합니다. – ChungkingExpress