Page 1 of 1

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

Posted: Sat Feb 27, 2010 11:41 pm
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??

Posted: Sun Feb 28, 2010 4:55 am
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.

Posted: Sun Feb 28, 2010 10:22 am
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......

Posted: Sun Feb 28, 2010 10:32 am
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.

Posted: Sun Feb 28, 2010 7:23 pm
by FSkyline
Ok!! Thank you!! I`m going to try it!!

Posted: Mon Mar 01, 2010 6:52 am
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).

Posted: Tue Mar 02, 2010 12:20 pm
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!!

Posted: Mon Mar 08, 2010 12:43 am
by karljoesen
Well this is may issue and i'm finding this solution. Thanks