New tutorial: "Integrating OGRE with wxWidgets."
- Noiprox
- Halfling
- Posts: 64
- Joined: Mon Apr 05, 2004 6:25 am
- Location: North Vancouver, Canada
New tutorial: "Integrating OGRE with wxWidgets."
Here is PDF and demo (Visual Studio .NET source only, sorry).
Comments and suggestions always welcomed (copy & paste, anti-spam):
mailto:%6E%6F%69%70%72%6F%78%40%74%65%6C%75%73%2E%6E%65%74
Comments and suggestions always welcomed (copy & paste, anti-spam):
mailto:%6E%6F%69%70%72%6F%78%40%74%65%6C%75%73%2E%6E%65%74
Dieter Buys
"Death, be not proud, though some have called thee mighty and dreadful, for thou art not so." - John Donne
"Death, be not proud, though some have called thee mighty and dreadful, for thou art not so." - John Donne
- sinbad
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
- Contact:
- SpannerMan
- Gold Sponsor
- Posts: 446
- Joined: Fri May 02, 2003 10:05 am
- Location: UK
- Contact:
- bad_camel
- Halfling
- Posts: 74
- Joined: Tue Dec 17, 2002 11:57 am
- Location: Somerset, England
- Contact:
You start off saying that ogre provides a xplatform integrated gui system, but sometimes something more mature is needed. This I interpret as the reason for the document.
I find this blurs a line that some people new to gui's within 3d apps find hard(surprisingly) to grasp.
There are 2 ways that guis are used in 3d apps. Guis that are contained within and possibly managed by the app, like ogre's "in-app" gui system and the situation where you are using a gui system that contains a widget that happens to be a 3d viewport. They are quite different and in fact can be used together(although the reason to do this would be baffling).
It may be that I read that first sentence wrong, but perhaps further clarifying this difference in terms of ogre's gui and wxWidgets would serve to immediately inform the new comer to their context.
Good document though, I agree it has a proffesional touch
I find this blurs a line that some people new to gui's within 3d apps find hard(surprisingly) to grasp.
There are 2 ways that guis are used in 3d apps. Guis that are contained within and possibly managed by the app, like ogre's "in-app" gui system and the situation where you are using a gui system that contains a widget that happens to be a 3d viewport. They are quite different and in fact can be used together(although the reason to do this would be baffling).
It may be that I read that first sentence wrong, but perhaps further clarifying this difference in terms of ogre's gui and wxWidgets would serve to immediately inform the new comer to their context.
Good document though, I agree it has a proffesional touch
- :wumpus:
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
Nice tutorial! Although it's still platform dependent until we have a platform independent mechanism to do
First off, I don't think the SetExternalWindowHandle call should be a method on the RenderSystem but should be a parameter to the CreateWindow method (to facilitate for multiple 'OGRE areas')
Furthermore, we can generalise the window handle to a (void*), in which case windows puts a HWND and X11 a Window. Although I'm not sure what wx's GetHandle returns in the X11 case?
It would be so nice to use a
in an end user application without even caring which platform is used!
Code: Select all
HWND h = (HWND)(mFrame->GetHandle());
D3D9RenderSystem *rsys = ...;
rsys->SetExternalWindowHandle(h);
Furthermore, we can generalise the window handle to a (void*), in which case windows puts a HWND and X11 a Window. Although I'm not sure what wx's GetHandle returns in the X11 case?
It would be so nice to use a
Code: Select all
root->CreateRenderWindow(..., mFrame->GetHandle());
- Noiprox
- Halfling
- Posts: 64
- Joined: Mon Apr 05, 2004 6:25 am
- Location: North Vancouver, Canada
Thanks guys!
bad_camel, I see the distinction, but I don't consider it so important. I'll consider rephrasing it to articulate the difference more clearly. Perhaps I should show examples? I could put two screenshots side-by-side if that would help. I imagine that anyone who would go so far as to read my tutorial would probably already be able to tell the difference (it's aimed at intermediate-level programmers).
wumpus, I agree.
bad_camel, I see the distinction, but I don't consider it so important. I'll consider rephrasing it to articulate the difference more clearly. Perhaps I should show examples? I could put two screenshots side-by-side if that would help. I imagine that anyone who would go so far as to read my tutorial would probably already be able to tell the difference (it's aimed at intermediate-level programmers).
wumpus, I agree.
Dieter Buys
"Death, be not proud, though some have called thee mighty and dreadful, for thou art not so." - John Donne
"Death, be not proud, though some have called thee mighty and dreadful, for thou art not so." - John Donne
- Noiprox
- Halfling
- Posts: 64
- Joined: Mon Apr 05, 2004 6:25 am
- Location: North Vancouver, Canada
Hehe. It's a compromise - screen or print optimized. I chose screen. Can't please everyone. I'll see how it looks once paginated.tisba wrote:Nice, though you might want to regenerate the PDF to be more than one page long. My printer does not handle 60 inch long paper
Dieter Buys
"Death, be not proud, though some have called thee mighty and dreadful, for thou art not so." - John Donne
"Death, be not proud, though some have called thee mighty and dreadful, for thou art not so." - John Donne
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
I couldn't agree more !!:wumpus: wrote:...
First off, I don't think the SetExternalWindowHandle call should be a method on the RenderSystem but should be a parameter to the CreateWindow method (to facilitate for multiple 'OGRE areas')
Furthermore, we can generalise the window handle to a (void*), in which case windows puts a HWND and X11 a Window. Although I'm not sure what wx's GetHandle returns in the X11 case?
It would be so nice to use ain an end user application without even caring which platform is used!Code: Select all
root->CreateRenderWindow(..., mFrame->GetHandle());
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- :wumpus:
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
I just found out that the GetHandle call in X11 returns a GTK_WIDGET.. ouch
A certain perl binding uses this code:
Maybe the X11 handle can be dug out of the GTK one some way, or we can use the Ogre-GTK frontend; but the problem is that this uses GTKmm(GTK C++ binding) and not plain GTK. So it should accept a plain GTK handle too and manually wrap it.. hmm
A certain perl binding uses this code:
Code: Select all
#ifdef __WXMSW__
WXHWND handle = THIS->GetHandle();
RETVAL = handle;
#else
WXWidget handle = THIS->GetHandle();
RETVAL = PTR2IV(handle);
#endif
- limpnode
- Gnoblar
- Posts: 5
- Joined: Tue May 25, 2004 5:44 am
- Location: unspecified
- Contact:
First off, thanks to Noiprox for providing the tutorial. Visual Studio is no longer a requirement to accomplish the task decribed in the PDF. I have built the demo using mingw ( gcc 3.3.1 ). The demo is available at:
http://the-agency.sourceforge.net/xoops ... =10&lid=46
The above download uses Ogre v0.14 and wxWidgets-2.5.2. However, I do not have Visual Studio and I am wondering whether or not the mingw version has the same look and feel as the Visual Studio version. Any input would greatly be appreciated.
http://the-agency.sourceforge.net/xoops ... =10&lid=46
The above download uses Ogre v0.14 and wxWidgets-2.5.2. However, I do not have Visual Studio and I am wondering whether or not the mingw version has the same look and feel as the Visual Studio version. Any input would greatly be appreciated.
Thank you for your time.
The Agency - http://the-agency.sourceforge.net/
The Agency - http://the-agency.sourceforge.net/
- Noiprox
- Halfling
- Posts: 64
- Joined: Mon Apr 05, 2004 6:25 am
- Location: North Vancouver, Canada
Nice work!
I'm getting strange problems, such as the menu bar not displaying correctly, and the window not being redrawn properly when I resize it. It seems as though the OGRE viewport is too large, so it's overlapping the menu, and the window frame is not resizing with the OGRE viewport.
I'm getting strange problems, such as the menu bar not displaying correctly, and the window not being redrawn properly when I resize it. It seems as though the OGRE viewport is too large, so it's overlapping the menu, and the window frame is not resizing with the OGRE viewport.
Dieter Buys
"Death, be not proud, though some have called thee mighty and dreadful, for thou art not so." - John Donne
"Death, be not proud, though some have called thee mighty and dreadful, for thou art not so." - John Donne
-
- Greenskin
- Posts: 114
- Joined: Wed Feb 11, 2004 5:41 pm
- Location: England!
- baxissimo
- Greenskin
- Posts: 135
- Joined: Wed Feb 23, 2005 1:28 pm
- Location: Tokyo, JAPAN
Fix
Instead of this:
I think you want to do something more like this:
Was this what you were referring to Supersuper?
--bb
Code: Select all
// Render system.
mRSys = mRoot->getRenderSystem();
D3D9RenderSystem *rsys = (D3D9RenderSystem *)mRSys;
rsys->SetExternalWindowHandle(handle);
Code: Select all
// Render window.
NameValuePairList misc;
misc["externalWindowHandle"] = StringConverter::toString((size_t)handle);
mWnd = mRoot->createRenderWindow("My sub render window", 100, 100, false, &misc);
--bb
-
- Halfling
- Posts: 88
- Joined: Tue Nov 30, 2004 2:34 am
I was trying to get this to work last night and im confused on how to cast the HWND now looking at your code.
I was using the namevaluepairlist and passing the HWND like this
Ogre::StringConverter::ToString((UINT)Handle);
not sure the size_t cast and the UINT cast makes a difference but cating as an int is bad.
I was using the namevaluepairlist and passing the HWND like this
Ogre::StringConverter::ToString((UINT)Handle);
not sure the size_t cast and the UINT cast makes a difference but cating as an int is bad.
-
- Gnoblar
- Posts: 1
- Joined: Wed May 11, 2005 11:15 pm
I'm trying to get this sample to compile, but I'm having some problems due to this being made for an older version of Ogre. I did what baxissimo suggests but I still get some errors with these lines:
If I comment those out, the program compiles but I get an exception "Cannot create window, no render system has been selected" at Root::CreateRenderWindow.
Any ideas?
Also, I would like to know if it's possible to use the OpenGL renderer with wxWidgets, or just D3D like this sample does.
Code: Select all
MaterialManager::getSingleton().parseAllSources();
ResourceManager::addCommonSearchPath("../Media");
ResourceManager::addCommonArchiveEx("../Media/cubemapsJS.zip", "Zip");
Any ideas?
Also, I would like to know if it's possible to use the OpenGL renderer with wxWidgets, or just D3D like this sample does.
- psyclonist
- OGRE Expert User
- Posts: 286
- Joined: Fri Nov 01, 2002 3:54 pm
- Location: Berlin & Nuremberg, Germany
- x 1
- Contact: