I'd like to announce the release of a new GtkOgre widget. It embeds Ogre render windows into GtkWidgets, but it's still very basic. You won't believe how many hours I spent with expose events and stopping it from flickering, though.
This is actually a side-product, because in the end I want to write a cross-platform wxWidget so it becomes very easy to embed Ogre on all platforms (Windows and Linux at least, don't know Mac).
The small demo application in action (it does nothing but display the scene):
By all reports the standard wxOgre widget from the wiki works fine for windows. I think we might need another custom effort like this on Mac, but I am not sure.
EDIT: Thanks for posting this, all the code you have to build the "parentWindowHandle" is directly applicable to wxOgre and wxGTK. Hopefully I or somebody else will actually find the time to update it. Now we really do need mac support.
I guess its time to start digging down into the Mac OpenGL support. For every ones edification, wxMac returns a ControlRef from Window::GetHandle().
I was not implying that the existing wxOgre didn't work. But it has some small limitations, no support for multiple render windows being one of them, but that's easy to overcome. Linux support was a bit more work, at least for wxGTK because it had to go through a custom GtkWidget. But I've put the cross-platform wxOgre on hold for a while, got tired of tumbling with wxWidgets, I hit some weird problems on Linux. And I found that the (free) tools for GTK development were much better.
DWORD, I'm playing a little with gtkogre widget and there is one "simple" problem. I can't force the widget to obtain signals other then "expose_event" and "scroll-event" (and probably destroy and delete ).
I've try add mask
and even add event box over a gtkogre widget. But without success.
Do you know how to solve this?
I think that, the problem is with "parentWindowHandle" and gdk_window_foreign_new struff. When I use "externalWindowHandle", gtk signals are o'k but window looks ... hm funy.
PS. I've try connect OIS to the Ogre render window, result: An exception has occured: Win32Mouse::Win32Mouse >> Failed to set coop level 64
I added a VC8 sln to buíld under windows i slightly modifi the demo to work against Eihort.
There a are still small bugs where no expose event is called.
I tested it with DX9 renderer plugin this works not so good as the OGL renderer maybe someone else should test it.
To bring back and old topic, has anyone got this to work on Ubuntu Dapper? I have gotten it running but it doesn't embed the windows, they are floating.
So, I am trying this with Ubuntu Edgy, and Ogre 1.3 CVS and it needs some change to run with the new release of Ogre. See bellow for the line that fails.
/* Get the window id of the render window */
XID xid;
ogre->render_window->getCustomAttribute("GLXWINDOW", &xid);
/* Create the widget's GdkWindow from the render window */
widget->window = gdk_window_foreign_new(xid); /* THIS FAILS */
gdk_window_set_user_data(widget->window, widget);
The getCustomAttribute line needs to be changed to:
I'm making game editor and want to make it with gtkmm/GTK+...On wiki I've found GTK ogre widget...I was happy:) but when I was using it I've encounter the bugs like no expose events or mouse motion notify events (as written in this topic)...so I was looking in code to find if something can be done to fix it...So I've made new gtkmm ogre widget...it is based on gtkmm custom widget example and GTK+ widget (first post in this topic)... I don't have any ftp server or so where can I put it...so I'm pasting the code here....hope it will help someone..it was tested on winXP with ogre 1.2.4, GTK+ 2.10.6, gtkmm 2.10.5-1
On the whole embedding Ogre issue, if I can't get this to work propely with stock wxWidgets, I will just use the GtkOgre widget with wxWidgets on Linux.
Ocelot wrote:I've resolved mouse event problems by using OIS
Yes, using OIS is another solution...If everything else have failed then OIS would be the solution..but why should I use another library if input can be done with gtkmm? And also when I was using OIS I had problem that I can't get input only for particular window in win32 (for particular HWND) only for whole main window...so another computations were needed there
There is no current BSD port of OIS unfortunately. I setup a FreeBSD VM machine here to start working on one. However, I was unable to get autotools working the way I wanted. And since the BSD demand has been low, it has not been a priority Really, what I would love, is someone fluent with BSD (and its joystick API) to sumit a patch.
Haven't really looked much at this lately, but I just wanted to let you know I've uploaded a new version, which should work with Eihort. You can grab it here: http://dword.dk/public/ogre/gtkogre-0.1.1-src.tar.bz2
The gtkmm stuff looks interesting. A lot cleaner than that "object-oriented" C in GTK+.
@Trigve: Is it possible to get a complete CB project of your gtkmm example(for windows). I´m trying to write a basic app with gtkmm and ogre (to stay object oriented), but need a working start point. Your example seems to be the perfect beginning. Thank you.