Hi,

yep, this is one of the really ugly problems nobody came up with a good
solution for. The simple fix is add the following code before you call
read :

for(int ui = 0; ui < filename.length(); ui++)
    if(filename[ui] == '/')
        filename[ui] = '\\';

The problem is that the loader tries to guess if you provide a unix or
windows path and in this case it guesses wrong because qt returns / 
instead of \ as the dir sep.

regards,
  gerrit

On Fri, 2004-09-03 at 17:17, Ganglbauer Kornelia wrote:
> Hallo!
> 
> I tried to create the OpenSG + QT example from the OpenSGStarterGuide and I
> CAN RUN IT!!!!!! (after three weeks it was a very exciting moment for me!)
> 
> But after the first delight I tried the function of the button and it did
> not work. The problem is, I can not load the scene file. 
> 
> This is the code of the function, that is called, when the button is
> clicked:
> void MainForm::load()
> {
>     QString s (QFileDialog::getOpenFileName(QString::null, "Szenenformate
> (*.wrl)"));
>     if (!s.isEmpty())
>     {
>       char *filename;
>       filename = (char *)s.latin1();
>       NodePtr n = SceneFileHandler::the().read(filename);
>       //NodePtr n = SceneFileHandler::the().read("data/terrain.wrl");
>       if (n != NullFC)
>           osgWidget->getManager().setRoot(n);
>       else
>           osgWidget->getManager().setRoot(makeTorus(0.5, 2, 16, 16));
>       
>       osgWidget->getManager().useOpenSGLogo();
>       osgWidget->getManager().showAll();
>       osgWidget->updateGL();
>       
>         
> 
>     }
> }
> 
> I found out, that it is possible to load the .wrl scene when I give the
> SceneFileHandler a relativ path (you find it in the comment of the code).
> But when I try to use the filename which I get from the FileDialog the
> SceneFileHandler cannot open the scene and n is a NullFC.
> 
> Do someone know what's wrong. Is it perhaps a problem of the different
> pathes under windows in equation to Linux (I run it under WindowsXP and use
> VisualStudio.Net 2003)?
> 
> Kornelia
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to