Problem in runing Mogre Application


24-09-2008 16:09:30

Hi, everybody!
I meet a strange problem ,but I really don't know why!
I bulid a app with Mogre 1.48 that work fine in my computer,but it can't work in anthor computer that haven't vs2008 and just install vcredist_x86,and I get a mistake like this:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.-->System.Runtime.InteropServices.SEHException:External component has thrown an exception.
at Ogre.Root.CreateRenderWindow(Root*,basic_string<char\,......)
at Mogre.Root.CreateWindow(Sting name,UInt32 width,......)

I need any help ,and appreciate!

I so sorry about my English!

Thanks ,again!


24-09-2008 23:10:48

Be shure that you installed the 2008 version of vcredist_x86.
I had a similar problem and found it out only after long searching.
The badly the filename is the same.

Try this Microsoft Visual C++ 2008 Redistributable Package (x86): ... 4b9f2bc1bf

If I remember right, only the release version is runnable by vcredist_x86.
With the debug version could be problems. (Maybe it depends to the kind of dll files. Some of them are extended for debugging and has some software depencies.)

A question to the others:
Does the vcredist_x86 2008 version also support the execution of applications compiled with VS 2005?
Or does I have to install vcredist_x86 2005 and 2008 together?


24-09-2008 23:33:45

Don't forget to install .NET 2.0
(or the newer version if you compiled for a 3.0 or 3.5)

Also you need the directx_nov2007_redist.exe (or maybe newer). ... df977d17b8 (nov 2007) ... 15d1d7199d (aug 2008)

The reason for a SEHException also can be a forgotten dll file (e.g. OgreMain.dll).


25-09-2008 02:11:40

Thanks Beauty ,thank you very much!

I really install Microsoft Visual C++ 2008 Redistributable Package (x86) , .net 2.0,and all .dll files that app need are there in the direct floder,include D3D9_39.dll,in that computer.
I have excuted my app in six difference computers ,Now,I know that my app work fine in three computers that use ATI display card,and can't work in the other computers that use nvidia display card.why?

Help me and thank you very much!


25-09-2008 02:25:37

Ogre is indepent of ATI / NVidia.
By the way: the ogre head Sinbad use NVidia cards.

You told about D3D9_39.dll.
Try to install a current DirectX Redistributable package.
Maybe not only this file is needed.
(The version of DirectX is still 9.0c, although the age and file content is different)

If I remember right, I also tried to copy only the needed file (known from the exception), but the problems were gone only after installing the above-named DirectX package.


25-09-2008 02:47:14

Thank you Beauty!
I would intall a current DirectX Redistributable package,and try again!

Thank you very much!


25-09-2008 02:59:01

I have intallded a current DirectX Redistributable package,and all d3d9 dll files in system32 floder ,but when I excute my app ,I also get the same error~ :(

beauty,there are any other idea?

Thank you very much!


25-09-2008 09:03:27

Are there inner exceptions?


25-09-2008 12:57:18

Now,I found the root of the problem.This is the part of my code:

Mogre.NameValuePairList misc = new Mogre.NameValuePairList();
misc["externalWindowHandle"] = _hWnd.ToString();
misc["FSAA"] = "6";
misc["vsync"] = "true";
misc["displayFrequency"] = "75";

_window = _root.CreateRenderWindow("Renderwindow", 0, 0, false, misc);

When I run my app in the computer that have NVIDIA display card,the error come from last line,but when I set misc["vsync"] = "false",my app can work,but the line that in my scene so crude after render! NVIDIA don't support "vsync" ?and there are any other method to improve the scene's quality?

I need any help and appreciate!


25-09-2008 13:29:56

Ogre-1.4.8 had problems with the newest nvidia drivers while running directx renderer. The problems were eliminated in version 1.4.9. As mogre is built using ogre-1.4.8 it may have those problems too. Though, it should work perfectly with opengl renderer.


25-09-2008 15:48:03

I seems that I was wrong. After giving a try to ogre-1.4.8 with last nvidia drivers I found out that everything works fine with directx. When I switch to opengl a lot of weird artifacts appear. :o


25-09-2008 18:49:20

Nice to know, that you come near to the problem.

Right, the problems can come from graphic drivers.
Maybe it's possible that older graphic cards doesn't support vsync?

One day I set my application to OpenGL (just for a try). Generally it works, but on one of 2 test computers there were texture problems with the heightmap terrain.

Maybe you can use the config window of Ogre before starting the application.
I think this comes automaticly of you don't set config params.
(Maybe I'm wrong. A solution could be in the tutorials or the MogreSDK.)


26-09-2008 12:51:41

Thank you everybody~
I think I was wrong,the root of my problem is "misc["FSAA"] = "6"; " in my code.but how can I improve my scene quality?In my scene I must use "ManualObject" draw a outline of a box,but when set misc["FSAA"] = "1",the lines that I draw are so crude !
And where are the sourse of method root.ShowConfigDialog()?I want to bulid a config window by myself!

Thank you very much!

I'm so sorry about my poor English!


01-10-2008 11:51:41

Good to know that you found the reason of the problem.

Maybe it's more nice if you add transparency to the line of ManualObject?

I want to bulid a config window by myself!
You can write an own window (with Windows Forms) where the user can set the options.
Then you start Ogre with the options of the form.
The options you can set by code like this:
// Setup RenderSystem
RenderSystem rs = root.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
rs.SetConfigOption("Full Screen", "No");
rs.SetConfigOption("Video Mode", "1024 x 768 @ 32-bit colour");

// Create Render Window
root.RenderSystem = rs;
root.Initialise(false, "Main Ogre Window");

In the API documentation of RenderSystem class all the options are descripted. ... ystem.html

If you write an option window (that works) it would be nice if you write the ready code to here. Then I would add it to the wiki.


01-10-2008 12:59:54

Wha! We can write our own window? I don't kow that, I will try it, I think


01-10-2008 14:14:30

If you use Visual Studio then it's very easy to create windows with the class System.Windows.Forms.
From the VisualStudio Toolbox window you can drag&drop buttons, checkboxes, etc.
Look to the documentation of Visual Studio and search for Forms. There are using examples and descriptions.