xwWidgets, Irrlicht & VC++ 2005

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
KevinCain
Posts: 18
Joined: Tue Aug 15, 2006 5:00 pm
Location: San Francisco

xwWidgets, Irrlicht & VC++ 2005

Post by KevinCain »

Like many people, I was excited to see how Nico managed to wrap a lovely wxWidgets GUI around Irrlicht with his IrrEdit 0.3 project (http://irredit.irrlicht3d.org/index.html).

On his blog, he offers a quick howto on the integration process: http://www.irrlicht3d.org/pivot/entry.php?id=347. However, while the two approaches he writes about make perfect sense, I was hoping to see a bit of concrete code to make the steps a little clearer.

Has anyone using VC++ 2005 managed to successfully get wxWidgets and Irrlicht to play nice with each other?

If anyone could share wx/Irrlicht 'hello world' code for a similar system, I'd be a very happy fellow.

A few details on my environment follow:

- wxWidgets version: wxPack_v2.6.3.25. I'm currently using Ryan Pusztai's Aug 8 2006 wxWidgets package--i.e., I did NOT build from source.

- IDE: Code::Blocks v1.0 rev 2821 (itself built on wx2.6.3)

- Irrlicht version: Irrlicht v1.1

- Compiler: VC++ 2005 Express

- OS: Windows XO-64 running on a 64-bit Athlon chip

Many thanks to the wonderful denizens of the Irrlicht forums,

-Kevin
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

Here's how I did it in Lua:

http://irrlua.sourceforge.net/14.wxWindow.lua

Unfortunately the latest versions of irrlua and wxLua are incompatible and it doesn't work anymore. IrrLua is lua 5.1. wxLua is lua 5.0 and statically linked.

The main trick I had to do to make it work was to make wxWidgets somehow process window messages. I couldnt' find any exposed methods to do it so I call wxFrame::Refresh() in the irrlicht rendering loop. It's a hack but it works. You probably won't have to do that as it was a wxLua issue, not wxWidgets.

The other important item is of course passing the wxFrame's window handle to createDeviceEx().

Code: Select all

local param = irr.SIrrlichtCreationParameters()

	param.WindowId = irr.cast.void_to_Number(win:GetHandle())
	param.DriverType = irr.video.EDT_OPENGL
	param.WindowSize = irr.core.dimension2d(200,200)
	device = irr.createDeviceEx(param)
Sorry the example is not C++ but it should be pretty straightforward to convert it from Lua. The sample is actually a conversion from the c++ project 14.win32window. You could probably copy that project and modify it according to the sample above.
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
KevinCain
Posts: 18
Joined: Tue Aug 15, 2006 5:00 pm
Location: San Francisco

Performance of wxWidgets & Irrlicht?

Post by KevinCain »

zenaku wrote:Sorry the example is not C++ but it should be pretty straightforward to convert it from Lua. The sample is actually a conversion from the c++ project 14.win32window. You could probably copy that project and modify it according to the sample above.
Thanks, zenaku, and no worries about C++ vs. Lua code, I saw from your site that you're a proponent of that language!

Did you encounter any negative performance aspects integrating Irrlicht with wxWidgets (i.e., speed)?

Thanks again for your notes!

-Kevin
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Re: Performance of wxWidgets & Irrlicht?

Post by zenaku »

KevinCain wrote:
zenaku wrote:Sorry the example is not C++ but it should be pretty straightforward to convert it from Lua. The sample is actually a conversion from the c++ project 14.win32window. You could probably copy that project and modify it according to the sample above.
Thanks, zenaku, and no worries about C++ vs. Lua code, I saw from your site that you're a proponent of that language!

Did you encounter any negative performance aspects integrating Irrlicht with wxWidgets (i.e., speed)?

Thanks again for your notes!

-Kevin
Nope not at all. wxWidgets is event based, so it's not doing much with the CPU. It shouldn't be any more intensive than using win32, Qt, or any othe r windowing system really.
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
KevinCain
Posts: 18
Joined: Tue Aug 15, 2006 5:00 pm
Location: San Francisco

GUI recommendations? (wxWidgets / Irrlicht)

Post by KevinCain »

Thanks, zenaku!

I'm interested to see if any C++ folks have any wise words about approaching a GUI using wxWidgets. As I noted above, Nico's results are quite encouraging, so I surprised not to see more activity on this topic in the forums. (Of course, I could be looking in the wrong spots!)

If anybody has a few lines to write on the subject, that could help.

-Kevin
arixion
Posts: 8
Joined: Fri Jun 02, 2006 4:16 pm

Post by arixion »

I always wondered why the functionality was not extended to linux...
Post Reply