Render to X11 window?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Andi|xng
Posts: 83
Joined: Thu Mar 24, 2005 10:49 pm
Location: Schrobenhausen, Germany
Contact:

Render to X11 window?

Post by Andi|xng »

Our game "Slam Soccer 2006" has a stadium editor, which consists of a Java Swing Frame and Controls and an Irrlicht frame in the middle.

Screenshot: http://www.bolzplatz2006.de/global/graf ... edit02.jpg

This is possible with createDeviceEx under windows (see http://irrlicht.sourceforge.net/tut014.html )

My question: Is something similar also possible for Linux (X11)? If yes, is it hard to do or only some lines of code?
If no, do you have an idea how we could run the stadium editor under linux anyway? Perhaps a borderless window that we move to the right position? (Is this possible, if yes, how?)

Thanks for any ideas :)
geekworx
Posts: 15
Joined: Sat Jul 01, 2006 12:10 pm
Location: Pretoria, South Africa
Contact:

Post by geekworx »

Anything is possible under linux ... the only problem is that you have a choice of like 1 000 different Widget creators.

Your best bet would be to use either GTK or Java ... that way you won't have to worry about specific KD or GNOME bindings.

What you would do instead of opening a Window's class you would rather use a Linux class.

Look at products like KDevelop or QT ... they will have the window calls that you require. All you need to do then is import your IrrLicht Linux library and with a little tweaking your program should work quite easily.

Although ... if you using Java it should be even easier.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

@geekworx: Please try to understand the problem stated before posting some unrelated or unspecific blah.
There is currently no support for external windows. A patch for allowing integration into GTK windows had been posted in the bug forum some time ago. It could also be possible to make the Irrlicht window a child of another window after creation. But I'm not sure how and with which consequences. It would be better to have some code in the Linux Device which handles external windows just as the Windows Device.
Andi|xng
Posts: 83
Joined: Thu Mar 24, 2005 10:49 pm
Location: Schrobenhausen, Germany
Contact:

Post by Andi|xng »

Thanks for the answers anyway. Now I use a normal Irrlicht window in combination with Swing windows - a little bit "GIMP style" instead of "single document interface style". I'll post a screenshot tomorrow, perhaps it's interesting fo other people which have the same "problem".
Andi|xng
Posts: 83
Joined: Thu Mar 24, 2005 10:49 pm
Location: Schrobenhausen, Germany
Contact:

Post by Andi|xng »

Here is a screenshot how we solved the problem:

http://www.xenoage.com/temp/scrshot/linuxge2.jpg

3 windows (2 Swing, 1 Irrlicht), but arranged in this way they look ok :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

What kind of native handle does Swing provide? Do you get a Window from X11?
Andi|xng
Posts: 83
Joined: Thu Mar 24, 2005 10:49 pm
Location: Schrobenhausen, Germany
Contact:

Post by Andi|xng »

hybrid wrote:What kind of native handle does Swing provide? Do you get a Window from X11?
I did not exactly understand your question.
Short description for both OSs:

Windows:
I want to use one maximized window with Irrlicht painting in a panel in the lower right corner. I can not use Swing for this control, because Irrlicht needs a HWND (window handle) so it can be initialized within a native "window" (means "panel" in our case). So I use a AWT panel (AWT is managed by the OS, Swing is managed by Java), from which I get the HWND by a small DLL (C++ code which returns the panel's HWND, can be found in the web).
Once Irrlicht is initialized in this panel, I overwrite the panel's paint()-method and call the Irrlicht drawing functions there.

Linux:
X11 seems to no have simple HWNDs, or they are not useable in Irrlicht at least. So I have no choice but creating a new Irrlicht window. Unfortunately I have no control over the window in Java, that means for example, I can not set it's position or size. But KDE automatically places the window on a acceptable position when it is initialized after the left toolbar window. Then the user has to move the windows by hand so they look lke on the screenshot.
If you have ideas how I could move the Irrlicht window, just tell me :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Indeed this was my question. The usual X11 native handles are Window ids. So you'll need a visual or a Window id or something.
Allowing to move the window is a different thing which could be possible, too. Using XMoveWindow is possible here, so grab the Exposed Data and use XMoveWindow with the Window handle stored there.
Andi|xng
Posts: 83
Joined: Thu Mar 24, 2005 10:49 pm
Location: Schrobenhausen, Germany
Contact:

Post by Andi|xng »

Thanks for the idea. I'll take a look at it.
Post Reply