Page 1 of 1

Cannot load saved scenes

Posted: Sun Apr 26, 2009 4:33 am
by kkrizka
Hi all,

I'm having trouble loading scenes saved with ISceneManager::saveScene() right now. However, I have no problems loading scenes generated with previous versions of irrlicht (pre 1.5).

I've modified both the irrlicht SVN and 1.5 (checked out from SVN) source so it prints out something everytime loadScene() reads something from the xml reader. The result is that nothing ever gets printed out.

This happens on 64-bit Gentoo Linux.

I'm using the following code to test this. At first, I create a scene with bunch of cubes and then save it to the file "geometry.irr". Then I comment out the cube generation/save code, and uncomment the loading code.

Code: Select all

include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

int main()
{
  IrrlichtDevice *device =
    createDevice( video::EDT_OPENGL, dimension2d<u32>(640, 480), 16,
		  false, false, false, 0);

  if (!device)
    return 1;

  IVideoDriver* driver = device->getVideoDriver();
  ISceneManager* smgr = device->getSceneManager();
  /*for(int i=0;i<10;i++)
    for(int j=0;j<10;j++)
      smgr->addCubeSceneNode(10,0,-1,
			     vector3df(i*10,0,j*i*10));
			     
   smgr->saveScene("geometry.irr"));*/
  
  smgr->loadScene("geometry.irr");


  smgr->addCameraSceneNodeFPS();

  while(device->run())
    {
      driver->beginScene(true, true, SColor(255,100,101,140));
      
      smgr->drawAll();
      
      driver->endScene();
    }
  
  device->drop();
  
  return 0;
}

Posted: Tue Apr 28, 2009 11:06 pm
by hybrid
The XML reader has some problems on 64bit systems. We have this bug in the tracker and so are working on this. No solution so far, though.

Posted: Mon Jul 20, 2009 11:07 am
by vectorcorpse
no. irrXML has severe problems on both 32 and 64 bit systems. it is writing in UTF32 and only reads UTF8 files. i know that because gedit only opens the irrlicht XML generated files after i tell it they are UTF32 and after i save them has UTF8 only then irrlicht is able to load them, and that happens on both my amd athlon 64 x2 939 4800+ with ubuntu 9.04 64bit and on my laptop intel p4 prescott 478 3200 with ubuntu 9.04 32bit.
it would be great if we could call something like:

Code: Select all

smgr->saveScene("geometry.irr",UTF8));
or

Code: Select all

smgr->loadScene("geometry.irr",UTF32);

Posted: Mon Jul 20, 2009 11:10 am
by hybrid
No, this works correct if your edtior saves the files with correct BOM, otherwise the default value won't match with some (not all!) editors. But first of all that's a problem of your editor.

Posted: Mon Jul 20, 2009 11:37 am
by vectorcorpse
?!? but i said the editor was working fine, the only thing that it fails to do is auto detect the UTF32 XML files that irrlicht generates witch is not a problem since it prompts me with a combo box to instruct him with the correct format and after that it opens the file and allows me to save it in any format i desire.
the problem is inside the app i am writing i need to save a scene and later i need to be able to load it and has kkrizka said, that is not working. i am only adding that it is not only a 64bit problem because it is behaving the same on a 32bit machine. they are both saving in UTF32 and trying to read it in UTF8 and the only way to get the app to read is to open the file on almost any editor and save it over in UTF8.
i can be wrong

Posted: Mon Jul 20, 2009 11:48 am
by vectorcorpse
wait... gedit says:
gedit has not been able to detect the character coding.
Please check that you are not trying to open a binary file.
Select a character coding from the menu and try again.
in the combo box it says: Currenct Local (UTF-8)
and if i change to (Unicode UFT-32) it reads well...
i am beginning to think this is a local problem
i mean a problem with the internationalization on the operating systems
on linux by default pt-latin-1 is UTF-8 on both 32 and 64 bit systems
maybe something is getting screwed up by the compiler it self based on the local definitions on the operating system used :/

Posted: Mon Jul 20, 2009 6:48 pm
by vectorcorpse
another thing is:
if i execute a saveScene the loadScene is not working on both my linux machines but if i open the resulting xml with gedit telling him it is a UTF-32 and then save it with a diferent name but also under UTF-32 the 2nd one works on the 32bit linux machine and if i compare the 2 with GHex the working xml generated with gedit has 8 extra bits in the end 0A 00 00 00
so i gess this is missing in the xml implementation. but still only solves the 32bit problems leaving the 64bit problem still there.
the way i see it the saveScene and loadScene functions are only working on 32bit windows and maybe mac but i can only say it isn't working since i don't actually have a working windows here only linux 64bit and 32bit
this is really strange and i am really rusty on c++