Has anyone created an activex control using MOGRE?


17-08-2007 10:43:41

Hey there!

Has anyone used C#/MOGRE to create an ActiveX usercontrol so that it can be viewed in a web browser, well... Internet Explorer?

I'm trying to get my projects to run through a webbrowser, using C#. So far i have created an ActiveX control (COM wrapper for .NET), and it works great. Then i try and use MOGRE....

When i call...
mRoot = new Root();
... it crashes.

I can see that my AX control calls MOGRE, and MOGRE calls OGRE, but it crashes and raises an SHSException.

Here is the stack:

************** Exception Text **************
System.Runtime.InteropServices.SEHException: External component has thrown an exception.
at Ogre.Root.{ctor}(Root* , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* )
at Mogre.Root..ctor()
at AX.Viewer.Init() in C:\Projects\AX\AX\Viewer.cs:line 36
at AX.myControl.button1_Click_1(Object sender, EventArgs e) in C:\Projects\AX\AX\Class1.cs:line 119
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Any ideas?! Any help, advice or direction from here would be much appreciated!

Many thanks,


17-08-2007 11:10:53

Forgot to say that it doesn't get as far as creating the Ogre.log so i can't see what's going on!


20-08-2007 22:15:00

Is it possible to show us some code? Because if it crashes on calling new Root() there is obviously no issue with the ActiveX Controll (although it might be the case, that it messes up some things really bad... but i dont believe so)... also which IDE do you use? Got VS.Net 2005 SP1 installed? Got all needed dlls in the build folder???


10-09-2007 16:46:19

Hi I've got a bit further with this project, I found out that the working folder for activeX controls defaults to the desktop!! So i change this and i get further, but i hit the RenderSystem and throws an error.

I'm using VS2005 Express with the SP1 installed, I have Mogre working fine as windows apps, even with the ActiveX in a windows form is fine, it's just when it comes to ActiveX in a webpage.

I have all the relevant DLL's in the correct folder now, but i now get the following error:

************** Exception Text **************
System.IO.FileNotFoundException: Could not load file or assembly 'Mogre, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'Mogre, Version=, Culture=neutral, PublicKeyToken=null'
at _Init_CLRObject_RenderSystem(CLRObject* pClrObj)
at Mogre.RenderSystem.op_Implicit(RenderSystem* t)
at Mogre.RenderSystemList.get_Item(Int32 i)

here is the simple code which works fine when it's in a windows form:

mRoot = new Root();
ResourceGroupManager.Singleton.AddResourceLocation("models", "FileSystem", "General");
RenderSystem rs = mRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem");

on that last line it throws the error, if i try and get the list of available render systems, and loop through them, they are there, but it's as if they are null or empty, if i try and do anything to them they throw the same error.

Any ideas?!


11-09-2007 15:07:28

I have updated the version of Mogre I was using to the latest version 0.2.2, and I get exactly the same problem!


21-08-2008 14:20:34

Hi --

It's been nearly a year since the last post on this thread, and I was wondering if anyone has been successful at getting an Mogre application to work in a browser (presumably using ActiveX). Rich Tufty -- were you ever successful with this?

I've developed a visualization application (authoring and runtime version deployment) using Mogre that runs in a Windows Form. Now apparently this needs to also run in a browser. I am aware of Pelican Crossing's Blink3D, but I've invested considerable time in developing a behavior and event triggering system as well as collision system using MogreNewt which I would hate to redo for Blink3D. Plus, I've based all of my scene loading and saving on oFusion which AFAIK Blink 3D does not support.

Any thoughts, ideas or experiences would be greatly appreciated.



03-09-2008 20:41:28

No takers?

If no-one has done this using ActiveX, what about using ASP.NET? Seems like that could be a viable approach, if one is using a UserControl for the Mogre window.

If anyone has experience with this, it would be great to hear. Otherwise, I will dive into this myself and report back if/when I get something working.


03-09-2008 23:32:01

Hi, I basically hit a brick wall with this, very limited information on this subject, and everyone I spoke to just brushes it under the carpet.

I basically got as far as...
getting it working as an active X control in a browser, BUT it only worked on a local machine in a browser. When the code was moved online, an error occurs when trying to view the activeX control. After a search around the net, it turned out to be a problem with actually deploying an ActiveX control written in C# in a webpage.

You may want to investigate this area? I don't know if it can even be done in C# because of this issue?

Would be great for someone else to dive in to this and find out more information!


04-09-2008 15:16:40

what about using ASP.NET?
I can't be much of a help but at least I can spare you from looking in the wrong direction and wasting a bit of time.
ASP.NET is server-side framework to produce HTML pages, it definitely isn't the solution here.


04-09-2008 17:37:37

Correct, server side isn't what you want here. You need to embed it in to a webpage.
Has anyone done it using C++ or Java? Thing is using C# would be ideal as it would fit in to existing framework.


04-09-2008 18:26:06

Correct, server side isn't what you want here. You need to embed it in to a webpage.
Has anyone done it using C++ or Java?

Ogre has been embedded in an ActiveX control before, the main forums can give some leads on this.