AliAkdurak
17-02-2011 12:24:39
Hello
We have simple simulation program where there is a main thread and a Render Thread. From our main thread we send message to ever-running render thread to start loading graphic engine make multiple render windows (Per display + One more) then create cameras create scene start rendering loop with render thread and so on. first time it runs it runs perfectly well.
Then we shutdown all the render windows with this code from the render thread.
And clean our scene like this.
So my problem is that after this when we start a new mission CreateRenderWindow function throws a wglMakeCurrent() failed message. I can't deduct why this could happen does anybody have any idea.
Note: This is my post at the Ogre Forums I am posting it here as it seems nobody stumbled upon or new anything why this could happen ?.
My application is a multi render window multi display application where render windows keep getting destroyed and created.
We have simple simulation program where there is a main thread and a Render Thread. From our main thread we send message to ever-running render thread to start loading graphic engine make multiple render windows (Per display + One more) then create cameras create scene start rendering loop with render thread and so on. first time it runs it runs perfectly well.
Then we shutdown all the render windows with this code from the render thread.
void ClassMogrePanel_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
{
try
{
_RWindowMCD.RemoveAllViewports();
_ViewportMCD.Dispose();
_ViewportMCD = null;
Mogre.Root.Singleton.DetachRenderTarget(_RWindowMCD);
}
catch (System.Runtime.InteropServices.SEHException ex)
{
if (Mogre.OgreException.IsThrown)
{
//TODO Multi language yapılacak
System.Windows.Forms.MessageBox.Show(Mogre.OgreException.LastException.FullDescription, "An Ogre exception has occured!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
}
else
{
System.Windows.Forms.MessageBox.Show(ex.ToString(), "An error has occured");
}
}
}
And clean our scene like this.
private void ShutdownAndCloseSingleThreaded()
{
this.QueueEndRendering();
MissionRuntime.SceneController.EffectController.RemoveEffects();
//Render queue ile yaptım fakat mogre kapanasaya kadar render queue erişim gecikiyor o yüzden direkt çağırdım
//RCommandRemoveEffects RemoveEffect = new RCommandRemoveEffects(this.SceneController.EffectController);
//_RuntimeGUILink.BroadCastCommand(RemoveEffect);
RCommandCloseControlForms CloseControlFormsCommand = new RCommandCloseControlForms();
MissionRuntime.RuntimeGUILink.BroadCastCommand(CloseControlFormsCommand);
RCommandCloseShootingForms CloseGraphicFormsCommand = new RCommandCloseShootingForms();
MissionRuntime.RuntimeGUILink.BroadCastCommand(CloseGraphicFormsCommand);
MissionRuntime.TargetController.ShutdownRegisteredTargets();
Mogre.SceneManagerEnumerator.SceneManagerIterator ISM = Mogre.Root.Singleton.GetSceneManagerIterator();
while (ISM.MoveNext())
{
ISM.Current.ClearScene();
ISM.Current.DestroyAllCameras();
ISM.Current.DestroyAllMovableObjects();
Mogre.Root.Singleton.DestroySceneManager(ISM.Current);
}
_SceneManager = null;
_CompletedSystemStates = _CompletedSystemStates | RenderSystemState.RenderSystemShutdown;
}
So my problem is that after this when we start a new mission CreateRenderWindow function throws a wglMakeCurrent() failed message. I can't deduct why this could happen does anybody have any idea.
Note: This is my post at the Ogre Forums I am posting it here as it seems nobody stumbled upon or new anything why this could happen ?.
My application is a multi render window multi display application where render windows keep getting destroyed and created.