PCs at school - program crashes when loading animated mesh
PCs at school - program crashes when loading animated mesh
Ahoy,
I'm currently working on a project, in which I load an IAnimatedMesh (with getMesh(...); )
At home it works fine, but I want to be able to play it (it is a game) at school, because sometimes we are allowed to play...
But there it crashes...
Due to the fact I can't compile / debug it here (at school) I can only tell you, that it's crashing when displaying "loaded mesh "...."(path)"
The file is there and I tried multiple file types (obj, b3d(this is the one, I want to use), 3ds, mesh, etc., I'm loading the file names with a text file,...)
Are you able to help me?
If you need more information, just ask!
Greetings Mateys!
I'm currently working on a project, in which I load an IAnimatedMesh (with getMesh(...); )
At home it works fine, but I want to be able to play it (it is a game) at school, because sometimes we are allowed to play...
But there it crashes...
Due to the fact I can't compile / debug it here (at school) I can only tell you, that it's crashing when displaying "loaded mesh "...."(path)"
The file is there and I tried multiple file types (obj, b3d(this is the one, I want to use), 3ds, mesh, etc., I'm loading the file names with a text file,...)
Are you able to help me?
If you need more information, just ask!
Greetings Mateys!
Yeah, we can't really do much without sources. You can still do a few things:
- Add more debug-output. If you know it's somewhere in loading then just add a few more log messages around that place to be sure you find the exact line where it crashes.
- Check if all your pointers are initialized and checked for 0 before being used. Uninitialized pointers are often a reasons why programs might behave different on different computers (or on the same computer...).
Also - try to reduce the problem to a shorter program. Figure out what is the shortest amount of code where it still crashes (that's then also the code you can post here to ask, but probably you found the bug by then).
Edit: I moved this to beginner.
- Add more debug-output. If you know it's somewhere in loading then just add a few more log messages around that place to be sure you find the exact line where it crashes.
- Check if all your pointers are initialized and checked for 0 before being used. Uninitialized pointers are often a reasons why programs might behave different on different computers (or on the same computer...).
Also - try to reduce the problem to a shorter program. Figure out what is the shortest amount of code where it still crashes (that's then also the code you can post here to ask, but probably you found the bug by then).
Edit: I moved this to beginner.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Yo ho ho,
thanks for your answer, this should be the relevant code:
the models.dat:
at home it works fine... is it possible, that the school computer is missing a driver or so.....
Thanks
[EDIT]
Oh sorry, I didn't see your answer...
Now I'm at home and I can't give you more output...
But I can tell you, the last line on the console window was:
loaded mesh "res/models/pistol_2.b3d"
Oh, wait.... I just thought of a possible mistake...
after loading the pistol model I load a gun model (should be the next output)
and this model was just a really bad try in modelling a tube with an ironsight, so maybe this file is the problem.
Tomorrow at school I'll try to use the pistol model twice and I'll tell you, whether it works or not!
But if anybody sees a mistake in my code, please tell me!
Thanks!
thanks for your answer, this should be the relevant code:
Code: Select all
std::ifstream in("res/models/models.dat");
std::string sm9, sm4a1, sm67;
in >> sm9;
in >> sm4a1;
in >> sm67;
// m9 is a pointer to an object of my class CWeapon, with the member node as a pointer to an IAnimatedMeshScenenNode
m9->node =
smgr->addAnimatedMeshSceneNode( smgr->getMesh(("res/models/" + sm9).c_str()),
camera,
-1,
vector3df(5, -5, 10),
vector3df(0, 0, 0),
vector3df(10.0f, 10.0f, 10.0f));
m9->node->setMaterialFlag(EMF_LIGHTING, false);
m9->node->setFrameLoop(3, 29);
m9->node->setAnimationSpeed(5);
Code: Select all
pistol_2.b3d
gun.3ds
grenade.3ds
Thanks
[EDIT]
Oh sorry, I didn't see your answer...
Now I'm at home and I can't give you more output...
But I can tell you, the last line on the console window was:
loaded mesh "res/models/pistol_2.b3d"
Oh, wait.... I just thought of a possible mistake...
after loading the pistol model I load a gun model (should be the next output)
and this model was just a really bad try in modelling a tube with an ironsight, so maybe this file is the problem.
Tomorrow at school I'll try to use the pistol model twice and I'll tell you, whether it works or not!
But if anybody sees a mistake in my code, please tell me!
Thanks!
did you ever tried to run the simple "hello world" programm from examples?
http://irrlicht.sourceforge.net/tut001.html
you can also build in the driverChoiceConcole() from driverChoice.h like here
http://irrlicht.sourceforge.net/docu/example010.html
to check that out.
in case on annother pc on your school the programm runs i think it is no path problem, may it has to do with restrictions to the machine where it is not running.
http://irrlicht.sourceforge.net/tut001.html
you can also build in the driverChoiceConcole() from driverChoice.h like here
http://irrlicht.sourceforge.net/docu/example010.html
to check that out.
in case on annother pc on your school the programm runs i think it is no path problem, may it has to do with restrictions to the machine where it is not running.
Hi, my project worked on these computers, until I included meshes (loaded meshes; the creation of cubes worked fine...)
Well...driverchoice is not possible, due to the fact I can't use the command line at school...
could that be the problem.... no wait... on the computer on which it worked I can't use it either....
so... which restriction could be the problem ? (we have many restrictions, in fact I'm happy it is possible to use flash drives )
thanks!
Well...driverchoice is not possible, due to the fact I can't use the command line at school...
could that be the problem.... no wait... on the computer on which it worked I can't use it either....
so... which restriction could be the problem ? (we have many restrictions, in fact I'm happy it is possible to use flash drives )
thanks!
Wow, didn't know that's possible...
but just as far as I know our IT-Admin I don't think so...
But is there a way I could find out what exactly makes the game crash when loading the mesh?
And if so, is there a solution for the problem I could simply try out?
Well... it is weekend and so I won't be at school until monday...
Thanks anyway
but just as far as I know our IT-Admin I don't think so...
But is there a way I could find out what exactly makes the game crash when loading the mesh?
And if so, is there a solution for the problem I could simply try out?
Well... it is weekend and so I won't be at school until monday...
Thanks anyway
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
Yes, it's called 'debugger".user-r3 wrote:But is there a way I could find out what exactly makes the game crash when loading the mesh?
"Whoops..."
Very possible. They did it when I was in high school. If it only happens at school, don't worry about it. You'll drive yourself nuts trying to figure it out, just to find out it is something that you have no control over and can't fix. My advice is to test it on a variety of computers outside of school and see if any of them have the same problem.Wow, didn't know that's possible...
multum in parvo
First step is to find out exactly what goes wrong. Given your code I would do the following. Put smgr->getMesh(("res/models/" + sm9).c_str()) into an own line and check the result to find out if loading is the problem. If that fails your code will crash as it doesn't seem to test for any invalid pointers later on. If that is the problem it could be that your working directory is not set correct. Do you for example from home always start from within your IDE?
Also you should check for the console-output as Irrlicht often gives useful warning messags if anything goes wrong.
Also you should check for the console-output as Irrlicht often gives useful warning messags if anything goes wrong.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Yo ho ho,
I changed my code to the following:
After getting the following output the programm collapses with the usual Windows XP ask for sending the error log...
Thanks!
I changed my code to the following:
Code: Select all
IAnimatedMesh* mesh;
mesh = smgr->getMesh((path + "res/models/" + sm9).c_str());
if (mesh)
{
std::cout << "\n\n\tLoaded pistol mesh successfully!\n";
m9->node =
smgr->addAnimatedMeshSceneNode( mesh, camera, -1,
vector3df(5, -5, 10),
vector3df(0, 0, 0),
vector3df(10.0f, 10.0f, 10.0f));
if (m9->node)
{
std::cout << "\n\t\tpistol node alright!\n";
m9->node->setMaterialFlag(EMF_LIGHTING, false);
m9->node->setFrameLoop(0, 29);
m9->node->setAnimationSpeed(5);
}
else
{
std::cout << "\n\t\tsomething wrong with the pistol node!\n";
}
}
else
{
std::cout << "\n\n\tCouldn't load pistol mesh successfully!\n";
}
mesh = smgr->getMesh((path + "res/models/" + sm4a1).c_str());
if (mesh)
{
std::cout << "\n\n\tLoaded gun mesh successfully!\n";
m4a1->node =
smgr->addAnimatedMeshSceneNode( mesh, camera, -1,
vector3df(5, -5, 10),
vector3df(0, 90, 0),
vector3df(10.0f, 10.0f, 10.0f));
if (m4a1->node)
{
std::cout << "\n\t\tgun node alright!\n";
m4a1->node->setMaterialFlag(EMF_LIGHTING, false);
m4a1->node->setFrameLoop(0, 29);
m4a1->node->setAnimationSpeed(5);
m4a1->node->setVisible(false);
}
else
{
std::cout << "\n\t\tsomething wrong with the gun node!\n";
}
}
else
{
std::cout << "\n\n\tCouldn't load gun mesh successfully!\n";
}
mesh = smgr->getMesh((path + "res/models/" + sm67).c_str());
if (mesh)
{
std::cout << "\n\n\tLoaded grenade mesh successfully!\n";
m67->node =
smgr->addAnimatedMeshSceneNode( mesh, camera, -1,
vector3df(5, -5, 10),
vector3df(0, 0, 0),
vector3df(10.0f, 10.0f, 10.0f));
if (m67->node)
{
std::cout << "\n\t\tgrenade node alright!\n";
m67->node->setMaterialFlag(EMF_LIGHTING, false);
m67->node->setFrameLoop(0, 29);
m67->node->setAnimationSpeed(5);
m67->node->setVisible(false);
}
else
{
std::cout << "\n\t\tsomething wrong with the grenade node!\n";
}
}
else
{
std::cout << "\n\n\tCouldn't load grenade mesh successfully!\n";
}
So does anybody know, what's the problem?...
Loaded mesh: ...(the path)
Loaded mesh successfully!
pistol node alright!
Thanks!
So it seems that it loads the pistol but not the other 2?
Then you should next check the values of the filenames, like:
Also, just use more debug-output. Add enough that you really figure out the line where it crashes. For example you could add another line after m9->node->setAnimationSpeed(5); in case anything crashes while you are changing the node.
I'm also a little irritated by your variable names like m9 and m67. Not sure what those are. But be sure they are initialized to 0 on start - in case those are uninitialized they could cause the crash here.
Then you should next check the values of the filenames, like:
Code: Select all
const char * name = (path + "res/models/" + sm4a1).c_str();
std::cout << name << "\n";
I'm also a little irritated by your variable names like m9 and m67. Not sure what those are. But be sure they are initialized to 0 on start - in case those are uninitialized they could cause the crash here.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm