Google

Mogre with MyGUI, PhysX and SlimDX

Discussion regarding the Managed .Net Wrapper for Ogre, MOGRE (http://sourceforge.net/projects/mogre)

Moderators: OGRE Team, MOGRE Moderators

Mogre with MyGUI, PhysX and SlimDX

Postby mstoyke » Thu Jul 22, 2010 8:32 pm

Hello everybody,

I don't have much time at the moment because I'm very busy. But I decided to release some things that I created in the past. It's a repository containing some libraries that I use for rapid prototyping my ideas.

The repository contains Mogre, SlimDX, eyecm-physx and MyGUI. All built with VS2010 and the .NET4 framework. All these components are slightly modified to work together in the way I need them. Be aware that they are all a little bit older, I don't see any need to update them as long as there are no changes in the official projects that I'm interested in.

You can find the repository at "http://bitbucket.org/mstoyke/enginedeps". It contains all sources that were used to compile the binaries that you can find in the "bin" folder. To compile anything yourself there is some work needed first to prepare the repository.

Take a look at the folders "DirectX\Include", "DirectX\Lib\x86" and "PhysX" to find some hints what is missing. If I remember correctly you need to copy some files from the DirectX SDK and the PhysX SDK before you'll be able to compile anything.

I might even have some solution files or project files in there that are still named "*VS2008*", but they are converted to VS2010 format. Sorry, there was no time to clean up the repository. I did not plan to release it for some time but now I can see that it may contain some valuable information for some Mogre users.

I also provided some code files in the "XampleCode" folder. Read the "Readme.txt" inside, it basically says you can use the example code only as reference to understand some of the libraries.

If somebody likes to take the task I give permission to post parts of these sources in the wiki for reference. They may contain some useful things. Especially some code to initialize Ogre from code only without the need of configuration files for the plugins.

If you have any questions about the files in the repository, feel free to ask them here. It may sometimes take some days for me to answer them but I'll try to keep an eye on this thread.

A little background:
I use Mogre/Ogre as graphics engine. There is more code, that I can't release, that handles my gameobjects so you may see some types named like "GO*" or "RO*", these are basically gameobjects(GO) or renderobjects(RO). The core library implements a MVC model for all game objects (also no code for this in the repo, sorry).

Every renderobject manages an Ogre entity and uses PhysX to handle all interaction in the game world. You may see some code in "ObjectManager.cs" that handles this connection.

MyGUI is used as GUI system. The MyGUI project provides a basic .NET wrapper for their widgets and has a pretty nice layout editor (also in the repository). I also added some functions to the wrapper of the core gui manager class to make life a little bit easier.

Then there is SlimDX. I use this library for input handling (mouse, keyboard, gamepad, ...) and I also have a small library that allows me to use the SlimDX D3D device wrapper to "hook" into the D3D device that is used by Ogre for rendering. This allows me to do some custom rendering magic by directly accessing the device during the Ogre renderloop. This code is also not provided at the moment, but the classes that hook into the device and handle DInput are provided.


Maybe this repository is useful for some of you and if you don't need any changes in the code you can just use the compiled binaries. And I like to thank all the creators of these fine libraries for making my coder-life so easy :)

For this message the author mstoyke has received kudos
mstoyke
Gremlin
 
Posts: 199
Kudos: 19
Joined: 25 May 2009
Location: Germany

Re: Mogre with MyGUI, PhysX and SlimDX

Postby Beauty » Fri Jul 23, 2010 1:07 pm

mstoyke wrote: But I decided to release some things that I created in the past.

Thanks :D

MyGUI is used as GUI system. [...] I also added some functions to the wrapper of the core gui manager class to make life a little bit easier.

I never heard that the MyGUI developers also added a .NET wrapper to their project. It's useful to know.
It would be nice, when you offer your improvements to the MyGUI maintainers.
When you just tell them about and give a link to your repository, then it wouldn't take much time for you and maybe they will add your improvements.

Then there is SlimDX.

For a non grapic project I also used SlimDX for input (just to check if some bottons are checked).
Maybe I'll look to your repository for a better and more powerful way to use it.
Maybe I also create a new wiki page for SlimDX. MOIS has some disadvantages (I can't remember details of my tests).

Somebody telled me that there would be a disadvantage:
It would be not enough to copy (and link) the dll file to your project, because of additional depencies, which needs the full installation of the SlimDX package.
Is this right? Or ist there a way to handle it without the setup file (e.g. just copy some dll files to the project binary directories).
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
IRC chat ... Mogre: irc://freenode/#mogre ... Ogre: irc://freenode/#ogre3d
User avatar
Beauty
OGRE Community Helper
 
Posts: 1645
Kudos: 37
Joined: 09 May 2007
Location: Germany

Re: Mogre with MyGUI, PhysX and SlimDX

Postby mstoyke » Fri Jul 23, 2010 1:18 pm

Beauty wrote:Somebody telled me that there would be a disadvantage:
It would be not enough to copy (and link) the dll file to your project, because of additional depencies, which needs the full installation of the SlimDX package.
Is this right? Or ist there a way to handle it without the setup file (e.g. just copy some dll files to the project binary directories).


It works quite well for me this way, I just copy the SlimDX.dll into my bin folder. The only dependency is the correct DirectX runtime. My binaries are compiled with Feb2010 DirectX SDK, so only this or newer versions of the DX runtime will work.
mstoyke
Gremlin
 
Posts: 199
Kudos: 19
Joined: 25 May 2009
Location: Germany

Re: Mogre with MyGUI, PhysX and SlimDX

Postby Beauty » Fri Jul 23, 2010 1:38 pm

Do you develop a game in a game company?
If so - what's the name of the company and some published games?
How many people work on your game? What type of game is it?
Which programs you use for level and model creation?
I'm interested in details :D
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
IRC chat ... Mogre: irc://freenode/#mogre ... Ogre: irc://freenode/#ogre3d
User avatar
Beauty
OGRE Community Helper
 
Posts: 1645
Kudos: 37
Joined: 09 May 2007
Location: Germany

Re: Mogre with MyGUI, PhysX and SlimDX

Postby mstoyke » Fri Jul 23, 2010 3:03 pm

There is some info available about me here:
http://www.mobygames.com/developer/shee ... Id,125826/
I'm currently working here:
http://e-eis.com/
as lead developer of the tinCat network middleware for multiplayer games and MMO's

If you can make it to the GDC Europe 2010 in Cologne, send me a PM maybe we can meet there ;)
mstoyke
Gremlin
 
Posts: 199
Kudos: 19
Joined: 25 May 2009
Location: Germany

Re: Mogre with MyGUI, PhysX and SlimDX

Postby kdr35 » Tue Jul 27, 2010 4:11 pm

I am new in Mogre , i want to use MyGui and i saw your "CompiledBinaries" and downloaded.
but I havent found any sample MyGui code in c# :?
and I converted something in c++ to c# but I think, I didnt convert correctly so I need MyGui code sample in c#.

And I have one dll problem , I didnt use your mogre.dll if I use your mogre.dll , my porject gives error so I didnt changed my mogre.dll (1.7.1 version .Net 4.0)

When I use your Mogre.dll , I took a error "A procedure imported by 'Mogre.dll' could not be loaded."

When I use my Mogre.dll , I took a error "A procedure imported by 'MyGUI.dll' could not be loaded."

How to use MyGui in .Net Framework 4.0 and 1.7.1 Mogre? I am new in mogre so can you explain shortly , please?

thanks...
kdr35
Kobold
 
Posts: 36
Kudos: 0
Joined: 22 Jul 2010

Re: Mogre with MyGUI, PhysX and SlimDX

Postby mstoyke » Tue Jul 27, 2010 7:20 pm

The libraries and the sourcecode in this repository is slightly changed for all of these libraries to work together. So I'm afraid you can't just replace some of the binaries. However you might be able to use these libraries if you compile them yourself and make then reference to the headers and import libraries for the version of Mogre/Ogre that you use.

Could you tell me which import won't work when you replace the Mogre.dll? I would like to see where this version differs from the official binary. And don't forget, if you replace the Mogre.dll you will also have to replace all Ogre DLLs.
mstoyke
Gremlin
 
Posts: 199
Kudos: 19
Joined: 25 May 2009
Location: Germany

Re: Mogre with MyGUI, PhysX and SlimDX

Postby AliAkdurak » Fri Jul 30, 2010 4:45 pm

Hello Mystoke

I am a teammate from kdr35's team, I was working on this thing and managed to pass the point where the dll loading fails. But unfortunatly I have some other problem:

On MyGUI.GUI.Initialise() specifically it's parameters as it needs a System.Intptr to scenemgr which I have only the managed wrapper ones reference which I cannot pass to it.

I tried something like this but it has thrown many accsess violations.

Code: Select all
DEBUG : target yaratıldı Name = Hedef5 Position = Vector3(458, 0, -950)
First-chance exception at 0x75089617 in AES3DCore.exe: Microsoft C++ exception: Ogre::ItemIdentityException at memory location 0x0023e718..
A first chance exception of type 'System.Runtime.InteropServices.SEHException' occurred in Mogre.dll
First-chance exception at 0x75089617 in AES3DCore.exe: Microsoft C++ exception: Ogre::ItemIdentityException at memory location 0x0023e718..
External component has thrown an exception.A first chance exception of type 'System.Runtime.InteropServices.SEHException' occurred in Mogre.dll
External component has thrown an exception.Step into: Stepping over property 'Mogre::Implementation::Wrapper::get_NativePtr'.  To step into properties, go to Tools->Options->Debugging and uncheck 'Step over properties and operators (Managed only)'.
The thread 'Win32 Thread' (0x12d8) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1bdc) has exited with code 0 (0x0).
Step into: Stepping over non-user code 'System.Collections.Generic.List<GraphicControlComponent.ClassGraphicPanel>.this[int].get'
The thread 'Win32 Thread' (0x1218) has exited with code 0 (0x0).
First-chance exception at 0x6e002000 in AES3DCore.exe: 0xC0000005: Access violation.
First-chance exception at 0x5c6c59f0 in AES3DCore.exe: 0xC0000005: Access violation reading location 0x6e002000.
First-chance exception at 0x5c6c59f0 in AES3DCore.exe: 0xC0000005: Access violation reading location 0x6e002000.
First-chance exception at 0x5c6c59f0 in AES3DCore.exe: 0xC0000005: Access violation reading location 0x6e002000.
First-chance exception at 0x5c6c59f0 in AES3DCore.exe: 0xC0000005: Access violation reading location 0x6e002000.
A first chance exception of type 'System.AccessViolationException' occurred in MyGUI.dll
First-chance exception at 0x5c6c59f0 in AES3DCore.exe: 0xC0000005: Access violation reading location 0x6e002000.
First-chance exception at 0x5c6c59f0 in AES3DCore.exe: 0xC0000005: Access violation reading location 0x6e002000.
First-chance exception at 0x5c6c59f0 in AES3DCore.exe: 0xC0000005: Access violation reading location 0x6e002000.
First-chance exception at 0x5c6c59f0 in AES3DCore.exe: 0xC0000005: Access violation reading location 0x6e002000.
First-chance exception at 0x5c6c59f0 in AES3DCore.exe: 0xC0000005: Access violation reading location 0x6e002000.
First-chance exception at 0x5c6c59f0 in AES3DCore.exe: 0xC0000005: Access violation reading location 0x6e002000.
An unhandled exception of type 'System.AccessViolationException' occurred in MyGUI.dll

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

The program '[0x1324] AES3DCore.exe: Native' has exited with code 0 (0x0).
The program '[0x1324] AES3DCore.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).


the code I tried was this

Code: Select all
           System.IntPtr x;           

            unsafe
            {
                 x = (System.IntPtr)SceneMgr.NativePtr;                     
            }
           
            MyGUI.Managed.Gui Temp;
            MyGUI.Managed.Gui.Initialise(((ClassMogrePanel)_GraphicPanelList[0]).Handle,x, "", "", "");


I also checked around to find CLRObject* to IntPtr converting without success.

Any suggestion how I might overcome this. in your xample code this stuff is loaded from one of your inner class so I couldn't get some tip from there too.
AliAkdurak
Halfling
 
Posts: 57
Kudos: 1
Joined: 25 May 2010
Location: Izmir / Turkey

Re: Mogre with MyGUI, PhysX and SlimDX

Postby mstoyke » Fri Jul 30, 2010 5:32 pm

Please try this:
Code: Select all
x = new IntPtr( SceneMgr.NativePtr );

and tell me if it works. This line of code can also be found in the class OgreManager in my XSample code folder in the repository.
And make sure the first IntPtr is actually a pointer to the Mogre RenderWindow NativePtr, just using the window handle of a .NET window or frame will not work.

Let me show you some lines of my init function (_windowHnd should be ((ClassMogrePanel)_GraphicPanelList[0]).Handle in your case, I think):

Code: Select all
      // parameters
      NameValuePairList parm = new NameValuePairList();

      mExternalWindowHandle = _windowHnd;
      if( mExternalWindowHandle != IntPtr.Zero )
      {
        parm[ "externalWindowHandle" ] = mExternalWindowHandle.ToString();
      }

      // ...

      // create window
      if( mExternalWindowHandle == IntPtr.Zero )
        mWindow = mRoot.CreateRenderWindow( "Midn8 Game Engine", 1600, 900, false, parm );
      else
        mWindow = mRoot.CreateRenderWindow( "Midn8 Game Engine (Ext)", 0, 0, false, parm );

      // ...

      // get reference to unmanager renderwindow
      unsafe
      {
        mWindowPtr = new IntPtr( mWindow.NativePtr );
      }

      // create scene manager
      mSceneMgr = mRoot.CreateSceneManager( SceneType.ST_GENERIC, "DefaultSceneManager" );

      // get reference to unmanaged scene manager
      unsafe
      {
        mSceneMgrPtr = new IntPtr( mSceneMgr.NativePtr );
      }


now use mWindowPtr as first parameter and mSceneMgrPtr as second parameter in Gui.Initialise(...).

Please let me know if this works for you.
mstoyke
Gremlin
 
Posts: 199
Kudos: 19
Joined: 25 May 2009
Location: Germany

Re: Mogre with MyGUI, PhysX and SlimDX

Postby AliAkdurak » Mon Aug 02, 2010 10:48 am

Code: Select all
First-chance exception at 0x75699617 in AES3DCore.exe: Microsoft C++ exception: Ogre::ItemIdentityException at memory location 0x0021e21c..
A first chance exception of type 'System.Runtime.InteropServices.SEHException' occurred in Mogre.dll
First-chance exception at 0x75699617 in AES3DCore.exe: Microsoft C++ exception: Ogre::ItemIdentityException at memory location 0x0021e21c..
External component has thrown an exception.A first chance exception of type 'System.Runtime.InteropServices.SEHException' occurred in Mogre.dll
First-chance exception at 0x0e1c1c68 (MyGUI.dll) in AES3DCore.exe: 0xC0000005: Access violation reading location 0xfeeeff16.
A first chance exception of type 'System.AccessViolationException' occurred in MyGUI.dll
External component has thrown an exception.* Initialise: OgreRenderManager
An unhandled exception of type 'System.AccessViolationException' occurred in MyGUI.dll


x = new IntPtr( SceneMgr.NativePtr ); didn't create any sufficient difference, it still throws two Ogre:ItemIdentifyException which I could not get their detail even If I put a SEH exception try catch around Initialize. I tought it could be because I didn't show a log a resource group or config(By the way I assumed it was Resources.Cfg but can you tell me if it is something different.). I looked at ItemIdentifyException in ogre manual it seems that exception is pretty common like input output exception.

I am not sure but maybe Ocham's razor is at work and I just fail to give simple file paths I will work on this. Today
AliAkdurak
Halfling
 
Posts: 57
Kudos: 1
Joined: 25 May 2010
Location: Izmir / Turkey

Re: Mogre with MyGUI, PhysX and SlimDX

Postby mstoyke » Mon Aug 02, 2010 11:48 am

MyGUI needs a pointer to the Ogre RenderWindow, this is not the same as the handle of a window on your desktop.

I think that you pass the wrong parameter in initialization, replace ((ClassMogrePanel)_GraphicPanelList[0]).Handle with the IntPtr to the Ogre Renderwindow Class. How you can get this IntPtr is detailed in my last post.

All the code in the Xample folder in the repository is copied from a working project, so you might not be able to use the code directly, but you can find all the information you need in there.

If the problem persists, you could send me the files from your sourcecode that deal with Mogre and MyGUI, so I could take a closer look.
mstoyke
Gremlin
 
Posts: 199
Kudos: 19
Joined: 25 May 2009
Location: Germany

Re: Mogre with MyGUI, PhysX and SlimDX

Postby AliAkdurak » Mon Aug 02, 2010 12:20 pm

I am sorry you are right that is a handle for a win32 window not a render window I will correct it right now try and report.

Ok I can now go beyond this point.

Thank you everything is working fine and sorry for the attention mistake.

By the way MyGUI can work on multiple render windows right ?

Edit: It seems that previous ogre log and those lines with error logs were not related.
Last edited by AliAkdurak on Mon Aug 02, 2010 12:57 pm, edited 1 time in total.
AliAkdurak
Halfling
 
Posts: 57
Kudos: 1
Joined: 25 May 2010
Location: Izmir / Turkey

Re: Mogre with MyGUI, PhysX and SlimDX

Postby mstoyke » Mon Aug 02, 2010 12:34 pm

AliAkdurak wrote:Thank you everything is working fine and sorry for the attention mistake.


You're welcome and don't worry about these kind of mistakes, these bugs just want to make sure that coding never gets too boring :)
mstoyke
Gremlin
 
Posts: 199
Kudos: 19
Joined: 25 May 2009
Location: Germany

Re: Mogre with MyGUI, PhysX and SlimDX

Postby Beauty » Thu Aug 05, 2010 3:31 pm

Maybe we could add a check to the init method. (Or ask the MyGUI maintainers to do this.)
Then at the call of the init method it will be checked if the reference is a win32 window or a render window.
If it's the "wrong" reference, then throw an exception with useful message text.
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
IRC chat ... Mogre: irc://freenode/#mogre ... Ogre: irc://freenode/#ogre3d
User avatar
Beauty
OGRE Community Helper
 
Posts: 1645
Kudos: 37
Joined: 09 May 2007
Location: Germany

Re: Mogre with MyGUI, PhysX and SlimDX

Postby mstoyke » Thu Aug 05, 2010 4:06 pm

Beauty wrote:(Or ask the MyGUI maintainers to do this.)


He won't help you, because this init function is one of the things I added to the MyGUI gui manager class.
mstoyke
Gremlin
 
Posts: 199
Kudos: 19
Joined: 25 May 2009
Location: Germany

Next

Return to MOGRE

Who is online

Users browsing this forum: No registered users and 1 guest

cron