Irrlicht3d.org
::
Blog
|
About Me
|
Twitter
Add comment for
How to integrate Irrlicht in a wxWidgets application
Posted by:
Enter the missing letter in: "Internatio?al"
Text:
[quote][b]Matthew[/b] wrote: Here is an expansion of the first method, which I am using that works in OpenGL :) One problem with wxWidgets is it is a bit tricky to integrate. In Win32 the default window proc is not called in the message loop, so if you decide to update the display continuously you'll need a way to send messages to Irrlicht. Unfortunately not all messages can be sent to irrlicht via the proc postEventFromUser, for example the resize event. One way to get around that is to manually add some methods to force resize in Irrlicht itself. In order to use wxWidgets, you'll need to override the default message loop like this: //overload this int EditorApp::OnRun() { SetExitOnFrameDelete(true); wxMainEventLoop eventLoop(this); wxEventLoop::SetActive(&eventLoop); m_mainLoop = &eventLoop; for ( ; ; ) { while (!Pending() && ProcessIdle()); while (Pending()) { if (!Dispatch()) { mShouldLeave = true; break; } } if (mShouldLeave) { while (Pending()) Dispatch(); m_mainLoop = NULL; return 0; } if (mFrame) mFrame->RenderFrame(); wxMilliSleep(10); // dont take up 100% of cpu as usual } m_mainLoop = NULL; return 0; } Definition of new class: namespace { class wxMainEventLoop : public wxEventLoop { public: wxMainEventLoop(EditorApp *editorApp); virtual void OnExit(); private: EditorApp *mEditorApp; }; } add this: namespace { wxMainEventLoop::wxMainEventLoop(EditorApp *editorApp) : wxEventLoop() { mEditorApp = editorApp; } void wxMainEventLoop::OnExit() { mEditorApp->SetShouldLeave(true); } }; good luck![/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons