samsamsam
18-08-2008 19:27:09
hi
i've tryed hard to know where is my problem and i gave up, i used this standard code to run an example, but it gives an exception
the code
and it lead me to afile named : list, and pointed to this code inside that file:
with an exception error ::
Unhandled exception at 0x0083f884 (MyGUI_d.dll) in test.exe: 0xC0000005: Access violation reading location 0xcdcdce51.
and the output is::
notice if i removed the line::
mGUI->injectFrameEntered(evt.timeSinceLastFrame);
i will have the program running with the mouse hanging in the upper left corner of the screen, but the camera clearly still moving.
am using VC 2005 sp1 , ogre1.4.7 , MyGUI_2.2.0_RC1
now u have my problem.
i know this question needs some effort, but i really hope if there is someone for giving me a hand.
thank u very much for OGRE
i've tryed hard to know where is my problem and i gave up, i used this standard code to run an example, but it gives an exception
the code
#include "Ogre.h"
#include "MyGUI.h"
#include "ExampleFrameListener.h"
using namespace Ogre;
/////////////////////////
void setupResources(void)
{
// Load resource paths from config file
ConfigFile cf;
cf.load("resources.cfg");
// Go through all sections & settings in the file
ConfigFile::SectionIterator seci = cf.getSectionIterator();
String secName, typeName, archName;
while (seci.hasMoreElements())
{
secName = seci.peekNextKey();
ConfigFile::SettingsMultiMap *settings = seci.getNext();
ConfigFile::SettingsMultiMap::iterator i;
for (i = settings->begin(); i != settings->end(); ++i)
{
typeName = i->first;
archName = i->second;
ResourceGroupManager::getSingleton().addResourceLocation(
archName, typeName, secName);
}
}
}
//////////////////////////////////////////////// for GUI
// the listener::
class GuiFrameListener : public ExampleFrameListener, public OIS::KeyListener, public OIS::MouseListener
{
private:
MyGUI::Gui * mGUI;
bool mShutdownRequested;
public:
// NB using buffered input, this is the only change
GuiFrameListener(RenderWindow* mWindow,Camera* cam) : ExampleFrameListener(mWindow,cam),
mShutdownRequested(false)
{
windowResized(mWindow);
MyGUI::Gui * mGUI=new MyGUI::Gui();
mGUI->initialise(mWindow);
MyGUI::ButtonPtr button = mGUI->createWidget<MyGUI::Button>("Button", 10, 10, 300, 26, MyGUI::ALIGN_DEFAULT, "Main");
button->setCaption("exit");
mMouse->setEventCallback(this);
mKeyboard->setEventCallback(this);
}
bool GuiFrameListener::frameStarted(const Ogre::FrameEvent& evt)
{
using namespace OIS;
if(mWindow->isClosed()) return false;
//Need to capture/update each device
mKeyboard->capture();
mMouse->capture();
if( mJoy ) mJoy->capture();
bool buffJ = (mJoy) ? mJoy->buffered() : true;
//Check if one of the devices is not buffered
if( !mMouse->buffered() || !mKeyboard->buffered() || !buffJ )
{
// one of the input modes is immediate, so setup what is needed for immediate movement
if (mTimeUntilNextToggle >= 0)
mTimeUntilNextToggle -= evt.timeSinceLastFrame;
// Move about 100 units per second
mMoveScale = mMoveSpeed * evt.timeSinceLastFrame;
// Take about 10 seconds for full rotation
mRotScale = mRotateSpeed * evt.timeSinceLastFrame;
mRotX = 0;
mRotY = 0;
mTranslateVector = Ogre::Vector3::ZERO;
}
//Check to see which device is not buffered, and handle it
if( !mKeyboard->buffered() )
if( processUnbufferedKeyInput(evt) == false )
return false;
if( !mMouse->buffered() )
if( processUnbufferedMouseInput(evt) == false )
return false;
if( !mMouse->buffered() || !mKeyboard->buffered() || !buffJ )
moveCamera();
mGUI->injectFrameEntered(evt.timeSinceLastFrame);/////////////////////////// here is the problem
return true;
}
bool GuiFrameListener::mouseMoved( const OIS::MouseEvent &arg )
{
mGUI->injectMouseMove(arg);
return true;
}
bool GuiFrameListener::mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
mGUI->injectMousePress(arg, id);
return true;
}
bool GuiFrameListener::mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
mGUI->injectMouseRelease(arg, id);
return true;
}
bool GuiFrameListener::keyPressed( const OIS::KeyEvent &arg )
{
mGUI->injectKeyPress(arg);
return true;
}
bool GuiFrameListener::keyReleased( const OIS::KeyEvent &arg )
{
mGUI->injectKeyRelease(arg);
return true;
}
};
///////////////////////////////////////////////// end of GUI
/////////////////////
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#endif
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char *argv[])
#endif
{
// variables
Root *mRoot;
Camera* mCamera;
SceneManager* mSceneMgr;
RenderWindow* mWindow;
Ogre::String mResourcePath;
SceneNode* mFountainNode;
// Create application object
mRoot = new Root("plugins.cfg", "ogre.cfg", "Ogre.log");
setupResources();
mRoot->showConfigDialog();
mWindow = mRoot->initialise(true);
mSceneMgr = mRoot->createSceneManager(ST_GENERIC, "ExampleSMInstance");
// Create the camera
mCamera = mSceneMgr->createCamera("PlayerCam");
// Position it at 500 in Z direction
mCamera->setPosition(Vector3(0,0,500));
// Look back along -Z
mCamera->lookAt(Vector3(0,0,-300));
mCamera->setNearClipDistance(5);
// Create one viewport, entire window
Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue(1,1,0));
// Alter the camera aspect ratio to match the viewport
TextureManager::getSingleton().setDefaultNumMipmaps(5);
// Initialise, parse scripts etc
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
// Set ambient light
//mSceneMgr->setAmbientLight(ColourValue(0.2, 0.2, 0.2));
// Create a skydome
mSceneMgr->setSkyDome(true, "Examples/CloudySky", 5, 8);
// Create a light
Light* l = mSceneMgr->createLight("MainLight");
// Accept default settings: point light, white diffuse, just set position
// NB I could attach the light to a SceneNode if I wanted it to move automatically with
// other objects, but I don't
l->setPosition(20,80,50);
Entity *ent;
// Define a floor plane mesh
Plane p;
p.normal = Vector3::UNIT_Y;
p.d = 200;
MeshManager::getSingleton().createPlane("FloorPlane", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, p, 200000, 200000, 20, 20, true, 1, 50, 50, Vector3::UNIT_Z);
// Create an entity (the floor)
ent = mSceneMgr->createEntity("floor", "FloorPlane");
ent->setMaterialName("Examples/RustySteel");
// Attach to child of root node, better for culling (otherwise bounds are the combination of the 2)
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
////////////////////////////////////////////////////////
GuiFrameListener* mFrameListener= new GuiFrameListener(mWindow, mCamera);
mFrameListener->showDebugOverlay(false);
mRoot->addFrameListener(mFrameListener);
/////////////////////////////////////////////////////////
mSceneMgr->setFog(FOG_EXP, ColourValue::White, 0.0002);
mRoot->startRendering();
return 0;
}
and it lead me to afile named : list, and pointed to this code inside that file:
iterator begin()
{ // return iterator for beginning of mutable sequence
return (iterator(_Nextnode(_Myhead), this));
}
with an exception error ::
Unhandled exception at 0x0083f884 (MyGUI_d.dll) in test.exe: 0xC0000005: Access violation reading location 0xcdcdce51.
and the output is::
'test.exe': Loaded 'C:\OgreSDK\bin\debug\test.exe', Symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
'test.exe': Loaded 'C:\OgreSDK\bin\debug\OgreMain_d.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_5490cd9f\msvcp80d.dll', Symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_5490cd9f\msvcr80d.dll', Symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.
'test.exe': Loaded 'C:\OgreSDK\bin\debug\OIS_d.dll', Binary was not built with debug information.
'test.exe': Loaded 'C:\WINDOWS\system32\dinput8.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.
'test.exe': Loaded 'C:\OgreSDK\bin\debug\MyGUI_d.dll', Symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\imm32.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\lpk.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\usp10.dll', No symbols loaded.
'test.exe': Loaded 'C:\OgreSDK\bin\debug\RenderSystem_Direct3D9_d.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\d3d9.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\d3d8thk.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll', No symbols loaded.
'test.exe': Loaded 'C:\OgreSDK\bin\debug\RenderSystem_GL_d.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\glu32.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\MSCTFIME.IME', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\iglicd32.dll', Binary was not built with debug information.
'test.exe': Loaded 'C:\WINDOWS\system32\igldev32.dll', Binary was not built with debug information.
'test.exe': Loaded 'C:\WINDOWS\system32\mcd32.dll', No symbols loaded.
'test.exe': Unloaded 'C:\WINDOWS\system32\mcd32.dll'
'test.exe': Loaded 'C:\OgreSDK\bin\debug\Plugin_ParticleFX_d.dll', No symbols loaded.
'test.exe': Loaded 'C:\OgreSDK\bin\debug\Plugin_BSPSceneManager_d.dll', No symbols loaded.
'test.exe': Loaded 'C:\OgreSDK\bin\debug\Plugin_OctreeSceneManager_d.dll', No symbols loaded.
'test.exe': Loaded 'C:\OgreSDK\bin\debug\Plugin_CgProgramManager_d.dll', No symbols loaded.
'test.exe': Loaded 'C:\OgreSDK\bin\debug\cg.dll', Binary was not built with debug information.
'test.exe': Loaded 'C:\Program Files\Yahoo!\Messenger\idle.dll', No symbols loaded.
'test.exe': Loaded 'C:\Program Files\Yahoo!\Messenger\msvcr71.dll', No symbols loaded.
First-chance exception at 0x7c812a7b in test.exe: Microsoft C++ exception: Ogre::InvalidParametersException at memory location 0x0012e568..
'test.exe': Loaded 'C:\WINDOWS\system32\hid.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\setupapi.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\wintrust.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\crypt32.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\msasn1.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\imagehlp.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\ntmarta.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\wldap32.dll', No symbols loaded.
'test.exe': Loaded 'C:\WINDOWS\system32\samlib.dll', No symbols loaded.
First-chance exception at 0x7c812a7b in test.exe: Microsoft C++ exception: OIS::Exception at memory location 0x0012f568..
First-chance exception at 0x0083f884 (MyGUI_d.dll) in test.exe: 0xC0000005: Access violation reading location 0xcdcdce51.
Unhandled exception at 0x0083f884 (MyGUI_d.dll) in test.exe: 0xC0000005: Access violation reading location 0xcdcdce51.
The program '[5872] test.exe: Native' has exited with code 0 (0x0).
notice if i removed the line::
mGUI->injectFrameEntered(evt.timeSinceLastFrame);
i will have the program running with the mouse hanging in the upper left corner of the screen, but the camera clearly still moving.
am using VC 2005 sp1 , ogre1.4.7 , MyGUI_2.2.0_RC1
now u have my problem.
i know this question needs some effort, but i really hope if there is someone for giving me a hand.
thank u very much for OGRE