Mogre and GUI especially CEGUI

kubatp

25-08-2009 16:33:37

Hi,
I want to use one of GUI systems in my MOGRE application. I heard, that CEGUI is very good choise. Unfortunately I read this http://www.ogre3d.org/wiki/index.php/Mogre_CEGUI and it gave me the reason to doubt about this choise. Has anyone any experience with this association? How difficult is it and how stable is it? Is there better alternative with MOGRE?
Thank you Pavel

luismesas

25-08-2009 18:26:03

After some tries I must recommend you Miyagui (check another thread on this fubforum)

kubatp

26-08-2009 11:11:16

Hi luismesas,
thank you for reply. I read something about Miyagui and checked few threads about it. Is there some kind of tutorial, how can it be integrated, examples, etc...?
Which GUIs have you tried?
Thank you Pavel

kubatp

26-08-2009 11:18:03

Is it possible to run this on .NET 2.0 and VS 2005?

luismesas

26-08-2009 14:56:27

There is very few documentation about Miyagui read the Miyagui thread and post your doubts there.
I have tested Cegui on some proyects berofe and I don't run smooth on it
I have tested BetaGUI too, it's really lightweight and simple

On my experience using frameworks, Miyagui is now the best candidate because is on active development and seems to ve very lightweight and robust. Having a lack on documentation is not a big problem, when it reaches a stable version I'm sure there will be people posting snippets on wiki.

luismesas

26-08-2009 14:58:14

Is it possible to run this on .NET 2.0 and VS 2005?

I haven't tested but I don't see any reason for not working on it.

kubatp

26-08-2009 15:51:28

Hi,
I have just tested it, here is my code (pasted from few resources):
private void CreateGUI()
{
Miyagi.Controls.Panel p = new Miyagi.Controls.Panel("test");
p.Text = "test";


MOIS.ParamList pl = new MOIS.ParamList();
IntPtr windowHnd;
RenderWindow.GetCustomAttribute("WINDOW", out windowHnd); // window is your RenderWindow!
pl.Insert("WINDOW", windowHnd.ToString());

MOIS.InputManager inputManager = MOIS.InputManager.CreateInputSystem(pl);
MOIS.Mouse mouse = (MOIS.Mouse)inputManager.CreateInputObject(MOIS.Type.OISMouse, false);
MOIS.Keyboard keyboard = (MOIS.Keyboard)inputManager.CreateInputObject(MOIS.Type.OISKeyboard, false);
Miyagi.Core.GuiManager.Singleton.Initialize(mouse, keyboard, false);
Miyagi.Core.Gui gui = Miyagi.Core.GuiManager.Singleton.CreateGui("testx");
gui.Controls.Add(p);
}

Unfortunately this throws an exception: Method was not found : Void Mogre.RenderSystem._setSeparateSceneBlending(Mogre.SceneBlendFactor, Mogre.SceneBlendFactor, Mogre.SceneBlendFactor, Mogre.SceneBlendFactor).

I guess it's because of MOGRE 1.4.8 is used instead of new MOGRE 1.6.2, isn't it?

Would you mind to paste the Miyagi initialization code here, please?
I would be really grateful for it.
Thank you Pavel

luismesas

26-08-2009 15:58:18

I would suggest you to use MOGRE 1.6.2 I'm using it and its' really stable

For miyagui, download de the beta4 file from it's wiki page (http://www.ogre3d.org/wiki/index.php/Miyagi) and open the sample it contains.

Follow the sample as you have there all you need to Initialice it and do any test with it.

kubatp

12-09-2009 21:26:53

Hi,
I changed the MOGRE version to the latest one, it works, but no Miyagi panels appear and the cursor doesn't show up as well.
the code is
private void CreateGUI()
{


ResourceGroupManager.Singleton.AddResourceLocation(@"d:\temp\Miyagi1.0beta4b\bin\Media", "FileSystem");
ResourceGroupManager.Singleton.AddResourceLocation(@"d:\temp\Miyagi1.0beta4b\bin\Media\Gui", "FileSystem");
ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

MOIS.ParamList pl = new MOIS.ParamList();
IntPtr windowHnd;
RenderWindow.GetCustomAttribute("WINDOW", out windowHnd); // window is your RenderWindow!
pl.Insert("WINDOW", windowHnd.ToString());

MOIS.InputManager inputManager = MOIS.InputManager.CreateInputSystem(pl);
MOIS.Mouse mouse = (MOIS.Mouse)inputManager.CreateInputObject(MOIS.Type.OISMouse, false);
MOIS.Keyboard keyboard = (MOIS.Keyboard)inputManager.CreateInputObject(MOIS.Type.OISKeyboard, false);
Miyagi.Core.GuiManager.Singleton.Initialize(mouse, keyboard, true);
Miyagi.Core.GuiManager.Singleton.DoScissorTest = true;

Miyagi.Core.Gui gui1 = new Miyagi.Core.Gui("gui1");
Miyagi.Core.GuiManager.Singleton.Guis.Add(gui1);
Miyagi.Core.Gui gui2 = Miyagi.Core.GuiManager.Singleton.CreateGui("testxx");
gui2.Mode = Miyagi.Core.GuiMode.YPopup;
gui2.PopupRange = new Miyagi.Core.Couple<float>(0, 0.05f);
CreateMaterialSchemes();
CreateTextSchemes();

Miyagi.Controls.Panel p = new Miyagi.Controls.Panel("test");
p.Position = new Miyagi.Core.Position(100, 100);
p.Size = new Miyagi.Core.Size(200, 200);
Miyagi.Controls.Button b = new Miyagi.Controls.Button("sdfd");
b.Position = new Miyagi.Core.Position(10, 10);
b.Size = new Miyagi.Core.Size(50, 20);
p.Controls.Add(b);
gui2.Controls.Add(p);
gui1.Visible = true;

Root.FrameStarted += new FrameListener.FrameStartedHandler(this.Scene_FrameStarted);

Miyagi.Core.GuiManager.Singleton.AddOrphanControls(p.Controls);

//Miyagi.Rendering.SpriteRenderer sr = new Miyagi.Rendering.SpriteRenderer();


}

private bool Scene_FrameStarted(FrameEvent evt)
{
if (RenderWindow.IsClosed)
{
return false;
}

if (Miyagi.Core.GuiManager.Singleton != null)
Miyagi.Core.GuiManager.Singleton.Update(true);

return true;
}

private void CreateMaterialSchemes()
{
// auto create MaterialSchemes
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("ButtonMaterial", typeof(Miyagi.Controls.Button), "Button", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("EventButtonMaterial", typeof(Miyagi.Controls.Button), "EventButton", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("CheckBoxMaterial", typeof(Miyagi.Controls.CheckBox), "Checkbox", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("RadioButtonMaterial", typeof(Miyagi.Controls.RadioButton), "Radiobutton", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("PanelMaterial", typeof(Miyagi.Controls.Panel), "Panel", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("TextBoxMaterial", typeof(Miyagi.Controls.TextBox), "Textbox", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("ListBoxMaterial", typeof(Miyagi.Controls.ListBox), "Listbox", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("DropDownListMaterial", typeof(Miyagi.Controls.DropDownList), "DropDownList", true);

Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("ProgressBarHMaterial", typeof(Miyagi.Controls.ProgressBar), "ProgressbarH", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("ProgressBarVMaterial", typeof(Miyagi.Controls.ProgressBar), "ProgressbarV", true);

Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("SliderHMaterial", typeof(Miyagi.Controls.Slider), "SliderH", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("SliderVMaterial", typeof(Miyagi.Controls.Slider), "SliderV", true);

Miyagi.Core.GuiManager.Singleton.CreateCursor("CursorMaterial", new Miyagi.Core.Size(16, 16), new Miyagi.Core.Position(0, 0));
Miyagi.Core.GuiManager.Singleton.Cursor.Hotspots.Add(Miyagi.Core.Cursor.ResizeLeft, new Miyagi.Core.Position(8, 8));
Miyagi.Core.GuiManager.Singleton.Cursor.Hotspots.Add(Miyagi.Core.Cursor.ResizeTop, new Miyagi.Core.Position(8, 8));
Miyagi.Core.GuiManager.Singleton.Cursor.Hotspots.Add(Miyagi.Core.Cursor.ResizeTopLeft, new Miyagi.Core.Position(8, 8));
Miyagi.Core.GuiManager.Singleton.Cursor.Hotspots.Add(Miyagi.Core.Cursor.ResizeTopRight, new Miyagi.Core.Position(8, 8));

Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("CursorMaterial", typeof(Miyagi.Core.Cursor), "Cursor", true);

// manual create MaterialSchemes
Miyagi.Core.MaterialScheme msBackground = new Miyagi.Core.MaterialScheme("Background");
msBackground.Textures["Background"] = "Background.png";
Miyagi.Core.GuiManager.Singleton.MaterialSchemes.Add(msBackground);

Miyagi.Core.MaterialScheme msLogo = new Miyagi.Core.MaterialScheme("Logo");
msLogo.Textures["Logo"] = "Logo.png";
Miyagi.Core.GuiManager.Singleton.MaterialSchemes.Add(msLogo);

// create a MaterialScheme from a .material file
Miyagi.Core.MaterialScheme ms = Miyagi.Core.MaterialScheme.FromMaterialFile("OldButton", typeof(Button), "OldButton.material");
Miyagi.Core.GuiManager.Singleton.MaterialSchemes.Add(ms);
}

private void CreateTextSchemes()
{
// create TextSchemes from ttf fonts
Miyagi.Core.GuiManager.Singleton.CreateTextScheme("BlueHighwaySmall", "bluehigh.ttf", 12, 72, ColourValue.White);
Miyagi.Core.GuiManager.Singleton.CreateTextScheme("BlueHighwayWhite", "bluehigh.ttf", 16, 72, ColourValue.White);

// set the default TextScheme for all created controls
Miyagi.Core.GuiManager.Singleton.DefaultTextScheme = Miyagi.Core.GuiManager.Singleton.CreateTextScheme("BlueHighway", "bluehigh.ttf", 16, 72, ColourValue.Black);

// special TextScheme for the listbox
Miyagi.Core.TextScheme blue2 = new Miyagi.Core.TextScheme("BlueHighway2", "bluehigh.ttf", 14, 72, ColourValue.Black);
// MousePressed is the colour for the selected item
blue2.Colours[Miyagi.Core.MaterialChangingEvent.MousePressed] = new Miyagi.Core.TextScheme.ColourDefinition(ColourValue.Red, ColourValue.White);
// MouseEnter is the colour for the item under the mouse
blue2.Colours[Miyagi.Core.MaterialChangingEvent.MouseEnter] = new Miyagi.Core.TextScheme.ColourDefinition(new ColourValue(1, 1, 1));

Miyagi.Core.GuiManager.Singleton.TextSchemes.Add(blue2);

// create a image font from a existing Ogre font
Miyagi.Core.TextScheme imageText = Miyagi.Core.TextScheme.FromFont("Berlin", (FontPtr)FontManager.Singleton.Load("BerlinSans32", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME));
imageText.Colours[Miyagi.Core.MaterialChangingEvent.MouseLeave] = new Miyagi.Core.TextScheme.ColourDefinition(new ColourValue(1, 0, 0, 0.5f));
imageText.CreateFont();
Miyagi.Core.GuiManager.Singleton.TextSchemes.Add(imageText);
}


Can anyone tell me what am I doing wrong?
Thank you Pavel

smiley80

12-09-2009 21:55:35

You have to specify which material scheme you want to use for the controls:
e.g.:
Miyagi.Controls.Panel p = new Miyagi.Controls.Panel("test", "PanelMaterial");
and
Miyagi.Controls.Button b = new Miyagi.Controls.Button("sdfd", "ButtonMaterial");

As for the cursor:

The material scheme has to be created before you create the cursor.
So this line:
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("CursorMaterial", typeof(Miyagi.Core.Cursor), "Cursor", true);
has to be before this line:
Miyagi.Core.GuiManager.Singleton.CreateCursor("CursorMaterial", new Miyagi.Core.Size(16, 16), new Miyagi.Core.Position(0, 0));

kubatp

12-09-2009 22:34:53

Hi smiley80,
thank you really!
I changed it to this code :
private void CreateGUI()
{


ResourceGroupManager.Singleton.AddResourceLocation(@"d:\temp\Miyagi1.0beta4b\bin\Media", "FileSystem");
ResourceGroupManager.Singleton.AddResourceLocation(@"d:\temp\Miyagi1.0beta4b\bin\Media\Gui", "FileSystem");
ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

MOIS.ParamList pl = new MOIS.ParamList();
IntPtr windowHnd;
RenderWindow.GetCustomAttribute("WINDOW", out windowHnd); // window is your RenderWindow!
pl.Insert("WINDOW", windowHnd.ToString());

MOIS.InputManager inputManager = MOIS.InputManager.CreateInputSystem(pl);
MOIS.Mouse mouse = (MOIS.Mouse)inputManager.CreateInputObject(MOIS.Type.OISMouse, false);
MOIS.Keyboard keyboard = (MOIS.Keyboard)inputManager.CreateInputObject(MOIS.Type.OISKeyboard, false);
Miyagi.Core.GuiManager.Singleton.Initialize(mouse, keyboard, true);
Miyagi.Core.GuiManager.Singleton.DoScissorTest = true;

Miyagi.Core.Gui gui1 = new Miyagi.Core.Gui("gui1");
Miyagi.Core.GuiManager.Singleton.Guis.Add(gui1);
Miyagi.Core.Gui gui2 = Miyagi.Core.GuiManager.Singleton.CreateGui("testxx");
gui2.Mode = Miyagi.Core.GuiMode.YPopup;
gui2.PopupRange = new Miyagi.Core.Couple<float>(0, 0.05f);
CreateMaterialSchemes();
CreateTextSchemes();

Miyagi.Controls.Panel p = new Miyagi.Controls.Panel("test", "Button");
p.Position = new Miyagi.Core.Position(100, 100);
p.Size = new Miyagi.Core.Size(200, 200);
Miyagi.Controls.Button b = new Miyagi.Controls.Button("sdfd", "Button");
b.Position = new Miyagi.Core.Position(10, 10);
b.Size = new Miyagi.Core.Size(50, 20);
p.Controls.Add(b);
gui2.Controls.Add(p);
gui1.Visible = true;

Root.FrameStarted += new FrameListener.FrameStartedHandler(this.Scene_FrameStarted);

Miyagi.Core.GuiManager.Singleton.AddOrphanControls(p.Controls);

//Miyagi.Rendering.SpriteRenderer sr = new Miyagi.Rendering.SpriteRenderer();


}

private bool Scene_FrameStarted(FrameEvent evt)
{
if (RenderWindow.IsClosed)
{
return false;
}

if (Miyagi.Core.GuiManager.Singleton != null)
Miyagi.Core.GuiManager.Singleton.Update(true);

return true;
}

private void CreateMaterialSchemes()
{
// auto create MaterialSchemes
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("ButtonMaterial", typeof(Miyagi.Controls.Button), "Button", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("EventButtonMaterial", typeof(Miyagi.Controls.Button), "EventButton", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("CheckBoxMaterial", typeof(Miyagi.Controls.CheckBox), "Checkbox", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("RadioButtonMaterial", typeof(Miyagi.Controls.RadioButton), "Radiobutton", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("PanelMaterial", typeof(Miyagi.Controls.Panel), "Panel", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("TextBoxMaterial", typeof(Miyagi.Controls.TextBox), "Textbox", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("ListBoxMaterial", typeof(Miyagi.Controls.ListBox), "Listbox", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("DropDownListMaterial", typeof(Miyagi.Controls.DropDownList), "DropDownList", true);

Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("ProgressBarHMaterial", typeof(Miyagi.Controls.ProgressBar), "ProgressbarH", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("ProgressBarVMaterial", typeof(Miyagi.Controls.ProgressBar), "ProgressbarV", true);

Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("SliderHMaterial", typeof(Miyagi.Controls.Slider), "SliderH", true);
Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("SliderVMaterial", typeof(Miyagi.Controls.Slider), "SliderV", true);

Miyagi.Core.GuiManager.Singleton.CreateMaterialScheme("CursorMaterial", typeof(Miyagi.Core.Cursor), "Cursor", true);

Miyagi.Core.GuiManager.Singleton.CreateCursor("CursorMaterial", new Miyagi.Core.Size(16, 16), new Miyagi.Core.Position(0, 0));
Miyagi.Core.GuiManager.Singleton.Cursor.Hotspots.Add(Miyagi.Core.Cursor.ResizeLeft, new Miyagi.Core.Position(8, 8));
Miyagi.Core.GuiManager.Singleton.Cursor.Hotspots.Add(Miyagi.Core.Cursor.ResizeTop, new Miyagi.Core.Position(8, 8));
Miyagi.Core.GuiManager.Singleton.Cursor.Hotspots.Add(Miyagi.Core.Cursor.ResizeTopLeft, new Miyagi.Core.Position(8, 8));
Miyagi.Core.GuiManager.Singleton.Cursor.Hotspots.Add(Miyagi.Core.Cursor.ResizeTopRight, new Miyagi.Core.Position(8, 8));

// manual create MaterialSchemes
Miyagi.Core.MaterialScheme msBackground = new Miyagi.Core.MaterialScheme("Background");
msBackground.Textures["Background"] = "Background.png";
Miyagi.Core.GuiManager.Singleton.MaterialSchemes.Add(msBackground);

Miyagi.Core.MaterialScheme msLogo = new Miyagi.Core.MaterialScheme("Logo");
msLogo.Textures["Logo"] = "Logo.png";
Miyagi.Core.GuiManager.Singleton.MaterialSchemes.Add(msLogo);

// create a MaterialScheme from a .material file
Miyagi.Core.MaterialScheme ms = Miyagi.Core.MaterialScheme.FromMaterialFile("OldButton", typeof(Button), "OldButton.material");
Miyagi.Core.GuiManager.Singleton.MaterialSchemes.Add(ms);
}

private void CreateTextSchemes()
{
// create TextSchemes from ttf fonts
Miyagi.Core.GuiManager.Singleton.CreateTextScheme("BlueHighwaySmall", "bluehigh.ttf", 12, 72, ColourValue.White);
Miyagi.Core.GuiManager.Singleton.CreateTextScheme("BlueHighwayWhite", "bluehigh.ttf", 16, 72, ColourValue.White);

// set the default TextScheme for all created controls
Miyagi.Core.GuiManager.Singleton.DefaultTextScheme = Miyagi.Core.GuiManager.Singleton.CreateTextScheme("BlueHighway", "bluehigh.ttf", 16, 72, ColourValue.Black);

// special TextScheme for the listbox
Miyagi.Core.TextScheme blue2 = new Miyagi.Core.TextScheme("BlueHighway2", "bluehigh.ttf", 14, 72, ColourValue.Black);
// MousePressed is the colour for the selected item
blue2.Colours[Miyagi.Core.MaterialChangingEvent.MousePressed] = new Miyagi.Core.TextScheme.ColourDefinition(ColourValue.Red, ColourValue.White);
// MouseEnter is the colour for the item under the mouse
blue2.Colours[Miyagi.Core.MaterialChangingEvent.MouseEnter] = new Miyagi.Core.TextScheme.ColourDefinition(new ColourValue(1, 1, 1));

Miyagi.Core.GuiManager.Singleton.TextSchemes.Add(blue2);

// create a image font from a existing Ogre font
Miyagi.Core.TextScheme imageText = Miyagi.Core.TextScheme.FromFont("Berlin", (FontPtr)FontManager.Singleton.Load("BerlinSans32", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME));
imageText.Colours[Miyagi.Core.MaterialChangingEvent.MouseLeave] = new Miyagi.Core.TextScheme.ColourDefinition(new ColourValue(1, 0, 0, 0.5f));
imageText.CreateFont();
Miyagi.Core.GuiManager.Singleton.TextSchemes.Add(imageText);
}



The current situation is, that there is the mouse cursor, but I can't move with it. And there is a panel, which blinks....

Thank you for your help!
Pavel

smiley80

12-09-2009 23:10:32

Add the follwing after you create the MOIS.Mouse:

MOIS.MouseState_NativePtr state = mouse.MouseState;
state.width = (int)window.Width;
state.height = (int)window.Height;

Where 'window' is the renderwindow.

The panel blinks, because the cursor is inside the popup range of the gui (sets visibility to true), but not over a control (sets visibility to false).
I'll change that behaviour in the next release.

kubatp

12-09-2009 23:19:04

Hi smiley80,
I do really appreciate your afford and thank you for reply.
Unfortunately this change didn't change anything. It's still the same.
I am not really sure what is the problem with the panel? Is it mean, that there is no way to display the panel, even the cursor is not over the control?
I actually want to display some panels over the gui even the cursor is not over the control. Is it possible?
Thank you Pave

smiley80

13-09-2009 03:11:45

Regarding the cursor:
Apparently, the buffer mode has to be set to true.
MOIS.Mouse mouse = (MOIS.Mouse)inputManager.CreateInputObject(MOIS.Type.OISMouse, true);
MOIS.Keyboard keyboard = (MOIS.Keyboard)inputManager.CreateInputObject(MOIS.Type.OISKeyboard, true);



I am not really sure what is the problem with the panel? Is it mean, that there is no way to display the panel, even the cursor is not over the control?

Just remove:
gui2.Mode = Miyagi.Core.GuiMode.YPopup;
gui2.PopupRange = new Miyagi.Core.Couple<float>(0, 0.05f);


side note:
You don't have to check whether GuiManager.Singleton is null, it never is.

kubatp

13-09-2009 11:00:30

Hi Smiley,
you are right, that was the problem. I added to the panel all the available controls and everything works correctly. Thank you!
However sometimes there are some weird exception like "The underlying type of the ResourcePtr object is not of type Texture.":
v Mogre.TexturePtr.op_Implicit(ResourcePtr ptr)
v Miyagi.Rendering.SpriteRenderer.RenderSprites()
v Miyagi.Rendering.RenderManager.FireRenderers()
v Miyagi.Rendering.RenderManager.RenderQueue_Started(Byte queueGroupId, String invocation, Boolean& skipThisInvocation)
v Mogre.SceneManager.raise_RenderQueueStarted(Byte queueGroupId, String invocation, Boolean& skipThisInvocation)
v Mogre.SceneManager.OnRenderQueueStarted(Byte queueGroupId, String invocation, Boolean& skipThisInvocation)
v Mogre.RenderQueueListener_Director.renderQueueStarted(RenderQueueListener_Director* , Byte queueGroupId, basic_string<char\,std::char_traits<char>\,std::allocator<char> >* invocation, Boolean* skipThisInvocation)
v Ogre.Root.renderOneFrame(Root* )
v Mogre.Root.RenderOneFrame()
v Aggressors.UI.MogreForm.Go() v D:\pavel\uceni\agresori\currentVersion\GUI\MogreForm.cs:řádek 85
v Aggressors.UI.MogreForm.Run() v D:\pavel\uceni\agresori\currentVersion\GUI\MogreForm.cs:řádek 65
v Aggressors.UI.Program.Main() v D:\pavel\uceni\agresori\currentVersion\GUI\Program.cs:řádek 19


and when I want to close the application, it throws "Attempted to read or write protected memory. This is often an indication that other memory is corrupt" all the time
v Ogre.Root.{dtor}(Root* )
v Ogre.Root.__delDtor(Root* , UInt32 )
v Mogre.Root.!Root()
v Mogre.Root.~Root()
v Mogre.Root.Dispose(Boolean )
v Mogre.Root.Dispose()
v Aggressors.UI.MogreForm.OgreForm_Disposed(Object sender, EventArgs e) v D:\pavel\uceni\agresori\currentVersion\GUI\MogreForm.cs:řádek 246
v System.ComponentModel.Component.Dispose(Boolean disposing)
v System.Windows.Forms.Control.Dispose(Boolean disposing)
v System.Windows.Forms.ContainerControl.Dispose(Boolean disposing)
v System.Windows.Forms.Form.Dispose(Boolean disposing)
v Aggressors.UI.SecondForm.Dispose(Boolean disposing) v D:\pavel\uceni\agresori\currentVersion\GUI\SecondForm.Designer.cs:řádek 20
v System.ComponentModel.Component.Dispose()
v System.Windows.Forms.Form.WmClose(Message& m)
v System.Windows.Forms.Form.WndProc(Message& m)
v System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
v System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
v System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
v System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
v System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
v System.Windows.Forms.Form.DefWndProc(Message& m)
v System.Windows.Forms.Control.WndProc(Message& m)
v System.Windows.Forms.ScrollableControl.WndProc(Message& m)
v System.Windows.Forms.ContainerControl.WndProc(Message& m)
v System.Windows.Forms.Form.WmSysCommand(Message& m)
v System.Windows.Forms.Form.WndProc(Message& m)
v System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
v System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
v System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
v System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
v System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
v System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
v System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
v System.Windows.Forms.Application.DoEvents()
v Aggressors.UI.MogreForm.Go() v D:\pavel\uceni\agresori\currentVersion\GUI\MogreForm.cs:řádek 87
v Aggressors.UI.MogreForm.Run() v D:\pavel\uceni\agresori\currentVersion\GUI\MogreForm.cs:řádek 65
v Aggressors.UI.Program.Main() v D:\pavel\uceni\agresori\currentVersion\GUI\Program.cs:řádek 19


I am pretty sure, it's something minor I am missing there, but don't know what. Could you help me once more?
Thank you Pavel

smiley80

13-09-2009 17:55:54


However sometimes there are some weird exception like "The underlying type of the ResourcePtr object is not of type Texture.":

This has been reported before. I can't reproduce that on any of my machines (which run all 32-bit Win XP).


and when I want to close the application, it throws "Attempted to read or write protected memory. This is often an indication that other memory is corrupt" all the time

Make sure you call GuiManager.Singleton.Destroy before disposing the root.

kubatp

13-09-2009 22:32:07

Hi,
thank you. So is it some kind of bug, which is not related to my code?
Thank you Pavel

luismesas

07-10-2009 13:02:15


and when I want to close the application, it throws "Attempted to read or write protected memory. This is often an indication that other memory is corrupt" all the time


kubatp: do you found the solution to this? I'm getting same error.
simley80: seems likes there is anykind on bug when there is controls previously disposed. If I do not dispose any Control manually then root.Dispose() does not fails.

boinst

12-10-2009 02:31:29

I'm getting the same error on some computers (not all), and I'm using only Mogre and MOIS in my code, so it might be unrelated to your use of Miyagi.

PantheR

25-10-2009 01:52:05

Got the same texture exception... tried to use dll from #1 test but got following exception: oh... nevermind, it seems that bluehigh.ttf font doesn't support russian charset :)
Now testing with Panel and DropDowListBox... No crash yet.

PantheR

25-10-2009 01:57:48


kubatp: do you found the solution to this? I'm getting same error.

In some cases solution is to review your Dispose procedure(i.e. place mRoot disposing at the very end) or make sure that nothing is called after exception (i.e. events or some triggers). That worked for me :)

P.S.: Smiley80, There is a feature with DropDownListBox i want you to take a notice: when i click ddlb button that show ddList it is Ok but it will be nice to close ddList by clicking that button again (by now you must click elsewhere to close it - it is uncomfortable for apps where every single click elsewhere doeas matter)