AgentReactif
30-06-2009 22:54:35
Hello,
I'am having problems with MyGUI 2.2.2 and OpenGL RenderSystem. This occurs when I switch to an other game state and only if I create one (or many) Entity and SceneNode. My game crash on a call of Root::renderOneFrame(). If first looked at this post : viewtopic.php?f=17&t=9661&p=56318&hilit=initialise#p56318, but it seems to be something different here.
This is what I get in Visual Studio :
which can be approximatively translated to :
What I found so far is that :
- There is nothing neither in MyGUI.log neither in Ogre.log.
- The game doesn't crash with DirectX.
- The game doesn't crash without MyGUI (DirectX and OpenGL).
- The game doesn't crash if I don't reinitialise MyGUI.
- The game doesn't crash if I run it in debug mode with a breakpoint set on the call to renderOneFrame (Hit F5 to render one frame => slow framerate).
- The game still crash with the sources from svn-trunk.
- So far, I reproduced this behavior on three differents marchines.
I provided a minimalistic application (one source file) below that reproduces the crash.
Switching to an other game state is done this way :
1.1.Shutdown/Delete current GUI.
1.2.Remove viewport.
1.3.Destroy scene's camera.
1.4.Destroy scene's SceneManager.
<< Game state switch >>
2.1.Create SceneManager.
2.2.Create scene's Camera.
2.3.Create viewport.
2.4.Create/initialise MyGUI.
The code
I would appreciate if anybody has an idea or a solution to solve this problem.
Thanks for reading.
I'am having problems with MyGUI 2.2.2 and OpenGL RenderSystem. This occurs when I switch to an other game state and only if I create one (or many) Entity and SceneNode. My game crash on a call of Root::renderOneFrame(). If first looked at this post : viewtopic.php?f=17&t=9661&p=56318&hilit=initialise#p56318, but it seems to be something different here.
This is what I get in Visual Studio :
Exception non gérée à 0x697433f1 dans MyGuiTest.exe : 0xC0000005: Violation d'accès lors de la lecture de l'emplacement 0x00000010.
which can be approximatively translated to :
Unhandled exception at 0x697433f1 in MyGuiTest.exe : 0xC0000005: Access Violation while reading at position 0x00000010.
What I found so far is that :
- There is nothing neither in MyGUI.log neither in Ogre.log.
- The game doesn't crash with DirectX.
- The game doesn't crash without MyGUI (DirectX and OpenGL).
- The game doesn't crash if I don't reinitialise MyGUI.
- The game doesn't crash if I run it in debug mode with a breakpoint set on the call to renderOneFrame (Hit F5 to render one frame => slow framerate).
- The game still crash with the sources from svn-trunk.
- So far, I reproduced this behavior on three differents marchines.
I provided a minimalistic application (one source file) below that reproduces the crash.
Switching to an other game state is done this way :
1.1.Shutdown/Delete current GUI.
1.2.Remove viewport.
1.3.Destroy scene's camera.
1.4.Destroy scene's SceneManager.
<< Game state switch >>
2.1.Create SceneManager.
2.2.Create scene's Camera.
2.3.Create viewport.
2.4.Create/initialise MyGUI.
The code
#include <Ogre.h>
#include <MyGUI.h>
void enterState(int time, Ogre::Root* ogre, Ogre::RenderWindow* window, const Ogre::ColourValue& color)
{
Ogre::SceneManager* sceneMgr = 0;
Ogre::Camera* camera = 0;
Ogre::Viewport* viewport = 0;
Ogre::Entity* entity = 0;
Ogre::SceneNode* node = 0;
MyGUI::Gui* gui = 0;
//Create scene manager.
sceneMgr = ogre->createSceneManager(Ogre::ST_GENERIC, "SceneManager");
//Create camera.
camera = sceneMgr->createCamera("SceneCamera");
camera->setPosition(0, 500, 1000);
camera->lookAt(0, 0, 0);
camera->setNearClipDistance(0.1f);
camera->setAspectRatio(Ogre::Real(1024/768));
//Create viewport.
viewport = window->addViewport(camera);
viewport->setBackgroundColour(color);
//Create gui.
gui = new MyGUI::Gui();
gui->initialise(window);
//Create a cube.
entity = sceneMgr->createEntity("Cube", "cube.mesh");
node = sceneMgr->getRootSceneNode()->createChildSceneNode("CubeNode");
node->attachObject(entity);
//Rendering loop.
unsigned long timeElapsed = 0;
unsigned long timeFirstFrame = ogre->getTimer()->getMilliseconds();
while((ogre->getTimer()->getMilliseconds() - timeFirstFrame) < time)
{
ogre->renderOneFrame();
}
//Destroy
sceneMgr->destroySceneNode(node);
sceneMgr->destroyEntity(entity);
gui->shutdown();
delete gui;
window->removeAllViewports();
sceneMgr->destroyCamera(camera);
ogre->destroySceneManager(sceneMgr);
}
int main()
{
Ogre::Root* ogre = 0;
Ogre::RenderSystem* rs = 0;
Ogre::RenderWindow* window = 0;
//Ogre startup.
ogre = new Ogre::Root("", "");
//Load ressources.
Ogre::ResourceGroupManager::getSingleton().
addResourceLocation("media", "FileSystem");
//Load plugin.
ogre->loadPlugin("RenderSystem_GL_d");
//Get rendersystem.
rs = ogre->getAvailableRenderers()->at(0);
ogre->setRenderSystem(rs);
ogre->initialise(false);
//Create render window.
window = ogre->createRenderWindow("MyGuiTest", 1024, 768, false);
//Enter state one.
enterState(2000, ogre, window, Ogre::ColourValue(0.2f, 0.8f, 0.2f));
//Enter state two.
enterState(2000, ogre, window, Ogre::ColourValue(0.8f, 0.2f, 0.2f));
}
I would appreciate if anybody has an idea or a solution to solve this problem.
Thanks for reading.