pizzazhang
08-05-2011 13:59:23
Hi,
I'm using MOGRE in WinForm to develop a Editor, but I run into a problem.
The MOGRE's Demo of Winform just paint the scene once:
like:
I want the render form to handle my input event like MouseDown etc. and the Mogre should update after I do some action.
so I changed the code in Paint Event function:
OgreApp is a class I used to do the "Ogre things" without the WinForm, and the Update function is used to render the scene and change the camera's position etc.
I add some Forms in the Main Window(all the forms are dock form) and when I do some actions in the render form and then do something like hide one dock, then the problem occurred: I can't get the hide form back to front and sometime I can't close the window. Maybe the Application.DoEvents() can't response all the actions and I fell it's a bad idea that use a loop in the Paint Event function. Any advices to my situation? Do I need a Multi Thread (I used this way actually, but the window just pops up and then closed) ? If MT can solve my problem can anybody please tell me how to do it in the right way? Thanks in advance!
I'm using MOGRE in WinForm to develop a Editor, but I run into a problem.
The MOGRE's Demo of Winform just paint the scene once:
like:
private void RenderForm_Paint(object sender, PaintEventArgs e)
{
mRoot.RenderOneFrame();
}
I want the render form to handle my input event like MouseDown etc. and the Mogre should update after I do some action.
so I changed the code in Paint Event function:
private void RenderForm_Paint(object sender, PaintEventArgs e)
{
while (OgreApp.Singleton.RenderWindow != null)
{
OgreApp.Singleton.Update();
Application.DoEvents();
}
}
OgreApp is a class I used to do the "Ogre things" without the WinForm, and the Update function is used to render the scene and change the camera's position etc.
I add some Forms in the Main Window(all the forms are dock form) and when I do some actions in the render form and then do something like hide one dock, then the problem occurred: I can't get the hide form back to front and sometime I can't close the window. Maybe the Application.DoEvents() can't response all the actions and I fell it's a bad idea that use a loop in the Paint Event function. Any advices to my situation? Do I need a Multi Thread (I used this way actually, but the window just pops up and then closed) ? If MT can solve my problem can anybody please tell me how to do it in the right way? Thanks in advance!
![Smile :)]({SMILIES_PATH}/icon_smile.gif)