render irrlicht window in dialog with diffrent thread

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
Phunk
Posts: 78
Joined: Sun Dec 14, 2003 8:18 pm
Location: The Netherlands

render irrlicht window in dialog with diffrent thread

Post by Phunk »

I guess this is more a windows API question, but I think it is also very related to irrlicht.

I have a (skinned) app, and when a certain event is received, I want to display a complete irrlicht app in a child window of the app.

I have created a dll with the irrlicht app, that I call from the main app. When I call the function to load the irrlicht app, I create a new thread(inside the dll) with the HWND(as argument) that I want to use as the window for rendering.

The HWND is passed to irrlicht as an element of "irr::SIrrlichtCreationParameters"

The HWND itself is a pointer to a button(resource in the dialog of the main app), that I paint black to use it as a placeholder for an overlay(used by irrlicht). I try to gain key focus by calling the HWND with SetFocus() from the irrlicht app thread.

I have based this method on the irrlicht example:"14.Win32Window".

Now the big problem: I cannot get key focus in the irrlicht window. Have I done it all wrong or is it just some function I should call;
Phunk
Posts: 78
Joined: Sun Dec 14, 2003 8:18 pm
Location: The Netherlands

Post by Phunk »

I have isolated the problem.

It seem to have to do something with the way I create irrlicht. When I modify the win32window example to use a separate thread for the irrlicht main loop, everything is fine.

When I change the executable into a dll and change the winmain into a function that I call from another windows app, the irrlicht-control (button) doesn't respond anymore and rendering also fails. Why does this happen? It seems to have no effect to make the window a child window of the main app.

Any help is greatly appriciated
Phunk
Posts: 78
Joined: Sun Dec 14, 2003 8:18 pm
Location: The Netherlands

Post by Phunk »

hmm solved the stuff with the dll loading. But I still cannot get any key focus when I load the window in a diffrent thread. Anyone an idea?
Phunk
Posts: 78
Joined: Sun Dec 14, 2003 8:18 pm
Location: The Netherlands

Post by Phunk »

well I solded the problem. the control that I placed the irrlicht window in(a button on a dialog, like in the example), did not receive any key messages at all. so I changed the control to a custom one with a separate wndproc to handle the key events, an passed them manually to irrlicht.
Still haven't figured out how to render into a child window of a window with WS_EX_LAYERED enabled without mannualy copying the image into it(performance loss!)
Post Reply