Multiple device troubles

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Multiple device troubles

Post by Tyn »

Having some strange results with creating multiple devices. Here is a little code:

Code: Select all

		MapTile =		smgr->getMesh("../data/meshes/cell.3ds");
		WallN =			smgr->getMesh("../data/meshes/walln.3ds");

		Wall1Text =		driver->getTexture("../data/textures/dead_wall1.jpg");
		Floor1Text =	driver->getTexture("../data/textures/dead_floor1.jpg");

		level = lvlParser->parseMap(file);
lvlParser is a class that creates it's own null device, then parses the XML map file and returns the level data. In the order it is currently in it works fine. However, if I change the order to:

Code: Select all

		level = lvlParser->parseMap(file);

		MapTile =		smgr->getMesh("../data/meshes/cell.3ds");
		WallN =			smgr->getMesh("../data/meshes/walln.3ds");

		Wall1Text =		driver->getTexture("../data/textures/dead_wall1.jpg");
		Floor1Text =	driver->getTexture("../data/textures/dead_floor1.jpg");
The program crashes, with the debugger unable to find any source to pinpoint the problem to. I think what is happening is that when it is trying to use the smgr, it is looking for it inside the null device instead of the main device. The null device not only doesn't have a scene manager created but the device has already been dropped.

This isn't a problem ATM, but when very soon I will be getting the mesh file locations from the level file and so will need to call in the non working order.

Any thoughts on a solution anyone?
Thulsa Doom
Posts: 63
Joined: Thu Aug 05, 2004 9:40 am
Location: Germany

Post by Thulsa Doom »

Tyn,
Just some thoughts.
You don't use smgr as static var do you?
Where is the null device created in class constructor
or at the beginning of lvlParser->parseMap(file); function,
where is it dropped?
Where is the other device created? Is it dropped befor creation of null device, and created new after, or does it stay in between?
ATM it's hard to tell from that piece of code,
why and how the null-device is used.
Check the smgr var befor and after variant 1 and 2 with a MessageBox.
Good luck!
Post Reply