Announcing new wxOgre Wiki page

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
User avatar
Yaniv
Halfling
Posts: 65
Joined: Thu Mar 02, 2006 1:28 am
Location: Israel
Contact:

Announcing new wxOgre Wiki page

Post by Yaniv »

LowPolyCoop - Join the freedom!
User avatar
jomunoz
Goblin
Posts: 228
Joined: Wed Apr 13, 2005 5:07 pm
Location: Medellin - Colombia

Re: Announcing new wxOgre Wiki page

Post by jomunoz »

Yaniv wrote:Hope this is useful to anyone :)

http://www.ogre3d.org/wiki/index.php/Wx ... _OGRE_v1.2
Yes it will be useful.

Thanks Yaniv.
pxL
Gremlin
Posts: 158
Joined: Fri Oct 07, 2005 11:48 am
Location: Hilversum, The Netherlands
Contact:

Post by pxL »

Great I'm sure it will be helpfull for a lot of people :D
User avatar
pjcast
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2543
Joined: Fri Oct 24, 2003 2:53 am
Location: San Diego, Ca
x 2
Contact:

Post by pjcast »

Looks really good.. Though, What lib's should you link against to make this work? Sorry if I missed that part.
Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/
User avatar
Yaniv
Halfling
Posts: 65
Joined: Thu Mar 02, 2006 1:28 am
Location: Israel
Contact:

Post by Yaniv »

pjcast wrote:Looks really good.. Though, What lib's should you link against to make this work? Sorry if I missed that part.
It's in the begining of the article under requirements
OGRE 1.2 [Dagon]
wxWidgets
LowPolyCoop - Join the freedom!
User avatar
pjcast
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2543
Joined: Fri Oct 24, 2003 2:53 am
Location: San Diego, Ca
x 2
Contact:

Post by pjcast »

I understand that you list it as a requirement, but what lib's for wxWidget to link to? As, just syaing Ogre, means OgreMain.lib, but I do not know wxWidgets, and I was just looking to get this working under linux (and, there is no wxWidget lib anywhere).
Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/
nihilocrat
Gnoblar
Posts: 20
Joined: Thu May 11, 2006 8:18 pm
Location: Greensboro, NC, USA

Post by nihilocrat »

WxOgre Wiki wrote: Supports Windows OS only (if somebody was able to get this to work on Linux or MacOS please add your code)
I find this sort of odd, seeing as how wxWidgets is cross-platform.
Perhaps bits of the h file need to be rewritten with #ifdef's and such(?)
User avatar
pjcast
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2543
Joined: Fri Oct 24, 2003 2:53 am
Location: San Diego, Ca
x 2
Contact:

Post by pjcast »

Well, I have discovered the libs (I think), but still get unresolved externals :/
Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/
User avatar
Yaniv
Halfling
Posts: 65
Joined: Thu Mar 02, 2006 1:28 am
Location: Israel
Contact:

Post by Yaniv »

nihilocrat wrote:
WxOgre Wiki wrote: Supports Windows OS only (if somebody was able to get this to work on Linux or MacOS please add your code)
I find this sort of odd, seeing as how wxWidgets is cross-platform.
Perhaps bits of the h file need to be rewritten with #ifdef's and such(?)
It is because you need to get the window handler somehow and every OS has a different type of handlers. There is an #ifdef in the code, it just has to be written by someone who really knows what he's doing in linux/mac
pjcast wrote:Well, I have discovered the libs (I think), but still get unresolved externals :/
That is a wxWidgets specific question, there are quite a few libraries to include and code to add. So please refer to their website for tutorials on the matter.
LowPolyCoop - Join the freedom!
User avatar
pjcast
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2543
Joined: Fri Oct 24, 2003 2:53 am
Location: San Diego, Ca
x 2
Contact:

Post by pjcast »

If there is a wiki article on something, well, it is nice if it tells you how to build the item in question. And, I have looked around at the website, which has ton's of out of date/dead links. So, sorry if I was asking a question you are not able to answer.
Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/
User avatar
Yaniv
Halfling
Posts: 65
Joined: Thu Mar 02, 2006 1:28 am
Location: Israel
Contact:

Post by Yaniv »

pjcast wrote:If there is a wiki article on something, well, it is nice if it tells you how to build the item in question. And, I have looked around at the website, which has ton's of out of date/dead links. So, sorry if I was asking a question you are not able to answer.
It builds exactly the same as using wxWidgets normally.
Sorry if it sounds like I'm being lazy, but there are far better tutorials on building wxWidgets than anything I could possibly write here in a few sentences. I don't have time to write a comprehensive tutorial on the matter, plus I don't see a reason to reinvent the wheel here.

If I learnt how to do it from their site, I don't see why anyone else can't.

Have you tries the wiki?
http://www.wxwidgets.org/wiki/index.php ... f_Contents
LowPolyCoop - Join the freedom!
User avatar
Game_Ender
Ogre Magi
Posts: 1269
Joined: Wed May 25, 2005 2:31 am
Location: Rockville, MD, USA

Linux Update

Post by Game_Ender »

I have scoured the forums, source code, and web have come up with how to Ogre what it wants out of the GetHandle() function. I must give plenty of credit to this wxWidgets forum thread for showing me how to get the needed information out of the wxWidgets handle. The source plus thisforum thread had the format ogre wanted.

I have updated the wiki but here is the code that does the work:

Code: Select all

	// Create a new parameters list according to compiled OS
	Ogre::NameValuePairList params;
	String handle;
#ifdef __WXMSW__
	handle = Ogre::StringConverter::toString((size_t)((HWND)GetHandle()));
#elif defined(__WXGTK__)
	// TODO: Someone test this, you might to use "parentWindowHandle" if this
	// does not work.  Ogre 1.2 + Linux + GLX platform wants a string of the
	// format display:screen:window, which has variable types ulong:uint:ulong.
	GdkWindow * window = GetHandle()->window
	handle = Ogre::StringConverter::toString((ulong)GDK_WINDOW_XDISPLAY(window));
	handle += ":0:";
	handle += Ogre::StringConverter::toString((uint)GDK_WINDOW_XID(window));
#else
	#error Not supported on this platform.
#endif
	params["externalWindowHandle"] = handle;
I don't have the time to test this right now, so I would love to know if it works.
User avatar
Rodif
Halfling
Posts: 46
Joined: Wed Nov 30, 2005 6:40 pm

Post by Rodif »

Btw, i have something very similar to this code. But there is an issue using a timer to render the scene and using modal dialogs. If your scene takes longer to render than the timer takes to fire off, it will make it so modal dialogs never leave their eventloop. I posted something to the wxwindows forums. They basically said 'dont use a timer to do something longer than the timer takes to fire'.

One soultion that im working on now, is to fire off a timer a couple milliseconds after renderoneframe() is called. This allows the modal dialogs eventloop time to shut down after renderoneframe() is callled.
Tyger
Gnoblar
Posts: 22
Joined: Sun Jun 04, 2006 6:26 pm

Post by Tyger »

Rodif wrote:Btw, i have something very similar to this code. But there is an issue using a timer to render the scene and using modal dialogs. If your scene takes longer to render than the timer takes to fire off, it will make it so modal dialogs never leave their eventloop. I posted something to the wxwindows forums. They basically said 'dont use a timer to do something longer than the timer takes to fire'.

One soultion that im working on now, is to fire off a timer a couple milliseconds after renderoneframe() is called. This allows the modal dialogs eventloop time to shut down after renderoneframe() is callled.
Heh, I've seen that issue before. The way they solved it was to disable rendering when any modal dialogues were up.

I am trying to do something with wxOgre as well, and I will probably be modifying it to run a separate thread for Ogre. Of course, that will have a severe impact on the architecture because Ogre is not thread safe, so any UI interactions will need to be indirect as a message to the Ogre thread to change something.
User avatar
pjcast
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2543
Joined: Fri Oct 24, 2003 2:53 am
Location: San Diego, Ca
x 2
Contact:

Post by pjcast »

In my little editor (using c#). I have the ogre rendernig done in a seperate thread for continous rendering. However, I use c#'s lock keyword to lock the conatiner class that holds all Ogre structures (root, scenemanager's, etc). And, I leave it up to the plugins (my app has ogre in the main app, the rest of the features are implemented in plugins) to be reponsible for using the lock keywod on the structure whenever they access/modify ogre. Of course, a misbehaving plugin could not use lock, and cause problems.. But, that is just the stance I took.

Of course, for c++, you could replace the lock keyword with mutex's/sephomores/etc depending on need. Messages is one way to do it, but is not the only way ;)
Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/
Rekk2
Gnoblar
Posts: 7
Joined: Tue Jul 11, 2006 1:43 pm

Post by Rekk2 »

Hi, my first post here. I compiled ogre 1.2.1 on ubuntu 6.06 amd64 and tried code from wiki for wxwidgets, well it didn't work but it was a nice start.

Did some minor changes to it.
At begining of wxOgre.cpp I added:

Code: Select all

#include <gdk/gdkx.h>
and changed:

Code: Select all

	GdkWindow * window = GetHandle()->window
	handle = Ogre::StringConverter::toString((ulong)GDK_WINDOW_XDISPLAY(window));
	handle += ":0:";
	handle += Ogre::StringConverter::toString((uint)GDK_WINDOW_XID(window));
to:

Code: Select all

	GtkWidget *widget = GetHandle();
	gtk_widget_realize(widget);
	GdkWindow * window = GetHandle()->window;
	handle = Ogre::StringConverter::toString((ulong)GDK_WINDOW_XDISPLAY(window));
	handle += ":0:";
	handle += Ogre::StringConverter::toString((uint)GDK_WINDOW_XID(window));
No when it is created it opens another window for ogre control, but funny thing is that when i resize my wxFrame i see that ogre is picking up his events, like resize..

I create it from my wxFrame with:

Code: Select all

	ogre = new wxOgre(this);
	
	wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
	sizer->Add
		( ogre
		, 1
		, wxEXPAND | wxALL
		, 10
		)
	;
	SetSizer(sizer);
	sizer->SetSizeHints(this);
	ogre->update();
Any ideas how to fix this?
Tnx
User avatar
Yaniv
Halfling
Posts: 65
Joined: Thu Mar 02, 2006 1:28 am
Location: Israel
Contact:

Post by Yaniv »

I don't know anything about linux window programming... So I wonder if one of the linux gurus will be able to aid you :)
LowPolyCoop - Join the freedom!
Rekk2
Gnoblar
Posts: 7
Joined: Tue Jul 11, 2006 1:43 pm

Post by Rekk2 »

Changed externalWindowHandle to parentWindowHandle (just random change on my part, didn't know that it will do anything).

Well now i have it where i what it, but its 20x20 and not resizing with rest of my frame. But still picking up its resize events..
User avatar
Game_Ender
Ogre Magi
Posts: 1269
Joined: Wed May 25, 2005 2:31 am
Location: Rockville, MD, USA

Post by Game_Ender »

Glad to see someone is getting use out of the code I posted. Am I to understand the code I posted does not work without the "gtk_widget_realize" line? After looking up that function I don't think using it is a good idea. It looks like its supposed to create the GdkWidget for the GtkWidget if it hasn't been created, but wxWidgets is already supposed to do this. So calling this twice might cause problems. Have you tried the original code I posted?
Rekk2
Gnoblar
Posts: 7
Joined: Tue Jul 11, 2006 1:43 pm

Post by Rekk2 »

I added it becouse you can't get XID of widget until it is realized, gtk will not create it until then, with out it i just get segmentation faults, what was excepted.

Now i can manualy set window to any size i wish, but it just dosn't resize. I can see in ogres output he is registering resize events, but it has the same size on the screen.
Rekk2
Gnoblar
Posts: 7
Joined: Tue Jul 11, 2006 1:43 pm

Post by Rekk2 »

Uh.. yes i tried your original code. The thing is wxWidgets must realize all gtk widgets, but you can realize realized component, it has no effect. Gtk dosn't create any x resources until widget is realized and I guess wxWidgets is not realizing any of them until wxFrame is shown.
User avatar
Game_Ender
Ogre Magi
Posts: 1269
Joined: Wed May 25, 2005 2:31 am
Location: Rockville, MD, USA

Post by Game_Ender »

Rekk2 wrote:Now i can manualy set window to any size i wish, but it just dosn't resize. I can see in ogres output he is registering resize events, but it has the same size on the screen.
By "ogre" do you mean the Ogre library or the wxOgre widget. Thanks for correcting me on the gtk issue, I don't really have any GTK programming experience. The only way to know about the realize issue it check the wxControl/wxWindow source code to if they do realize the widget.
Rekk2
Gnoblar
Posts: 7
Joined: Tue Jul 11, 2006 1:43 pm

Post by Rekk2 »

wxOgrel, ogre rendering window, and even gtk widget, they all say the same size, and that is the correct one, but on screen i see only the initial region repainted, changing color while i resize as set in your test.
Rekk2
Gnoblar
Posts: 7
Joined: Tue Jul 11, 2006 1:43 pm

Post by Rekk2 »

It seams that rendering was not done on wxOgre control at all, instead on parent wxFrame. wxControl widget is set to GtkScrolledWindow, and he has no asociated x resource. Now i placed aditional GtkPanel inside it and rendering is done on it.

My problem with resizing is still there, and I'm out of ideas. Help :)
Ceacy
Halfling
Posts: 81
Joined: Sat Jan 29, 2005 5:47 pm
Location: Paris, France.
Contact:

Post by Ceacy »

Rekk2> I'm currently faced to the same problem (no render done, and Ogre render window dissociated from frame). Did you manage to get it fixed ?

Thanks,
Ceacy.
Post Reply