Can't load .irr files?? :S:S

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
FSkyline
Posts: 5
Joined: Sat Feb 27, 2010 11:25 pm

Can't load .irr files?? :S:S

Post by FSkyline »

Hi! It's my first post here, and I don't know if this is the right place to post this

I'm doing a little Demo as an university project. I currently have configured de sceneary in irrEdit, but when I want to load it with irrlicht, i can't.

The scenary is this

Image

I set up a work directory in irrEdit, and it can load everything, but irrlicht doesn't. It shows me this messeage:

Unable to open scene file: ../../Media/Escenario/escenario.irr

I follow the "loading a .irr file" tutorial, and I don't know what is happening.....

And here is the blog of the project ;)
http://thedarknesshunterproject.blogspot.com/

Does anybody knows what is happening??
d3jake
Posts: 198
Joined: Sat Mar 22, 2008 7:49 pm
Location: United States of America

Post by d3jake »

Could you post for us a short section of your code showing us your attempt to load your .irr file? Otherwise we can only guess as to what your problem may be.
The Open Descent Foundation is always looking for programmers! http://www.odf-online.org
"I'll find out if what I deleted was vital here shortly..." -d3jake
FSkyline
Posts: 5
Joined: Sat Feb 27, 2010 11:25 pm

Post by FSkyline »

Ok! The code is very very simple

Code: Select all

#include "irrlicht.h"
#include "iostream"

using namespace irr;

#ifdef _MSC_VER
#pragma comment (lib,"Irrlicht.lib")
#endif

int main(int argc, char** argv)
{
	//Preguntemos que tipo de driver queremos
	video::E_DRIVER_TYPE driverType = video::EDT_DIRECT3D9;

	printf ("DARKNESS HUNTER\n\nPor favor, seleccione el driver que desee antes de comenzar:\n\n"\
		" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
		" (d) Renderizado por software\n (otra) Salir\n");

	char i;
	std::cin >> i;

	switch (i)
	{
		case 'a': driverType = video::EDT_DIRECT3D9;break;
		case 'b': driverType = video::EDT_DIRECT3D8;break;
		case 'c': driverType = video::EDT_OPENGL;break;
		case 'd': driverType = video::EDT_SOFTWARE;break;
		default: return 1;
	}

	//Creamos el device y salimos si pulsamos otras teclas
	IrrlichtDevice *device = createDevice(driverType, core::dimension2d<u32>(640,480));

	if (device == 0)
		return 1;

	//Ponemos el titulo a la ventana
	device->setWindowCaption(L"Darkness Hunter");

	//Creamos los punteros a IVideoDriver e ISceneManager
	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* smgr = device->getSceneManager();

	//Cargamos la escena del archivo.irr
	if (argc>1)
		smgr->loadScene(argv[1]);
	else
	smgr->loadScene("../Media/escenario1.irr");

	//Ahora creamos la camara
	smgr->addCameraSceneNodeFPS(0, 50.f, 0.1f);
	


	//Ejecutamos el bucle
	while (device->run())
	if (device->isWindowActive())
	{
		driver->beginScene(true,true,video::SColor(0,200,200,200));
		smgr->drawAll();
		driver->endScene();
	}
		
	
	device->drop();
		return 0;

}
There are two different crashes.... the first one (the one I post yesterday) I think that is becouse I didn't specified the .irr file path ok, but when I change it to the one I think is the correct it found the .irr but can't load meshes, textures, lights...... It's rare, becouse when I open the .irr file with irrEdit, it detect everything......
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

It might be a problem with absolute/relative paths. You need to have the meshes and the .irr file in the proper place, relative to the app you start. Also make sure your working directory does not differ from what you'd expect it to be.
FSkyline
Posts: 5
Joined: Sat Feb 27, 2010 11:25 pm

Post by FSkyline »

Ok!! Thank you!! I`m going to try it!!
Brainsaw
Posts: 1183
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

You have to set the proper path in IrrEdit (set it to you application's working directory), and make sure your IDE has set the right working path as well (as the code::blocks template sets the working path to Irrlicht's path instead of the application path).
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
FSkyline
Posts: 5
Joined: Sat Feb 27, 2010 11:25 pm

Post by FSkyline »

Thanks for the tips! Finally I have used the scenry.obj and I will set up lights in the code. This weekend I'll try to configure al the paths...... but as I have the scenary loaded I'm working on the character animation in blender....

thanks!!
karljoesen
Posts: 3
Joined: Fri Mar 05, 2010 3:34 am

Post by karljoesen »

Well this is may issue and i'm finding this solution. Thanks
Post Reply