Troubles with wxOgre

Problems building or running the engine, queries about how to use features etc.
Post Reply
azmeuk
Kobold
Posts: 32
Joined: Mon Jan 01, 2007 6:30 pm
Location: France
Contact:

Troubles with wxOgre

Post by azmeuk »

Hello world
I've got troubles with wxOgre for OGRE v1.4, I'm running Ubuntu 7.10 and I've compiled this code. (Including the code of the note for Ubuntu users).
To make it compile properly I had to remplace

Code: Select all

#ifdef __WXGTK__
#include <gdk/gdk.h>
#include <gtk/gtk.h> // just this should suffice as it should include gdk.h itself
#endif
by

Code: Select all

#ifdef __WXGTK__
#include <gdk/gdkx.h>
#include <gtk/gtk.h> // just this should suffice as it should include gdk.h itself
#include <wx/gtk/win_gtk.h>
#include <gdk/gdkx.h>
#include <GL/glx.h>
#endif
(See here.)
My problem is that the program can't run : the core dump when I try to launch the program.
You can find all the files I used here (and the Ogre.log): http://ramoloss.azmeuk.fr/public/Ogre/ .
Any idea ?
Thanks you for your help
Last edited by azmeuk on Thu Apr 17, 2008 11:42 pm, edited 1 time in total.
azmeuk
Kobold
Posts: 32
Joined: Mon Jan 01, 2007 6:30 pm
Location: France
Contact:

Post by azmeuk »

If it can helps you, I found that it is the following line which makes the program crash.

Code: Select all

gtk_widget_realize( widget );
(in the createOgreRenderWindow function)
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

I have to admit to never using the GTK route in wxWidgets before. If you remove the part of your code that binds an Ogre renderwindow to your wxWindow, does it work then? Just trying to identify whether this is specific to the Ogre window binding or if it's more fundamental.
azmeuk
Kobold
Posts: 32
Joined: Mon Jan 01, 2007 6:30 pm
Location: France
Contact:

Post by azmeuk »

I found that if I comment the lines

Code: Select all

mRenderWindow->resize( width, height );
mRenderWindow->windowMovedOrResized();
in the wxOgre::OnSize function, the program runs but there is no Ogre widget displayed. (But if I uncomment one of the two lines, the program crashes)
Image
(or maybe it's the grey square on the top left corner of the window)
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

yeah, you'll need a way to sync up the sizes of the wx window / widget and the Ogre render window - listening in to a size event usually does it, it does in wx and Qt on Windows anyway. Maybe there's an init issue here, have you tried deferring the calls to those functions until sometime much later, when you know the window system is fully up and running? Maybe guard it with a boolean you set much later or something, see if it survives then. My experience is that sometimes window systems take a little while to 'bed down' if they have derived metrics, and sometimes you can even end up with zero or even negative dimensions passed in to functions like this that you have to filter out.
azmeuk
Kobold
Posts: 32
Joined: Mon Jan 01, 2007 6:30 pm
Location: France
Contact:

Post by azmeuk »

You were right, it seems that the tip of using a boolean works.
What I've done
* Declaration of a boolean member mIsInitialized in wxOgre.h
* mIsInitialised is set to false at the begin of the wxOgre constructor and false at the end.
* For each method related to a wxwidget event, insertion of :

Code: Select all

if(mIsInitialized){...}
Now the program runs and I've got a blank view port:
Image
Thank you, I update the wiki...

In fast I spoke too quickly. The ogre widget should have a title, like the others...
Post Reply