Hi Aaron,

I'm falt out on other work right now so can only give a few pointers.
First up I don't have any clues as to cause of crash or details of
what you are attempting.  In terms of internally store jpg/png's
within a .ive, I think this is possible, I vaguely remember a
submission about this a while back.  I'm afraid that as much help as I
can provide right now.  Have a dig through the ReaderWriter::Options
and image code in .ive.

Robert.

On 8/10/06, Aaron Rolett <[EMAIL PROTECTED]> wrote:
Hello All,
      I'm currently generating a large group of paged-lod ive files
and trying to access them using the net-plugin. When I write the ive
files out to disk, I set the image location to be relative to the ive
file location in the tree wtih image->setFileName(...) and then
setting the ive plugin option noTextureInIVE to keep the png images
outside of the ive files. This works great when you have local
access to the ive files. However, because the network plugin is
special cased in registry.cpp ... the following problem occurs when
trying to use my paged-lod files remotely. The ive file is retreived
from the server and is read. The reference to the image is found as a
local path (aka a/0.png) with a database path of localhost:qtree. Even
though the database path is set correctly, openscenegraph doesn't
realized that it should use the network plugin and fails to load the
file.

To fix this problem, I modified Registry.cpp to look at the first
databasePath and if it is a network link, then use the network plugin
(see code 1 below). This seems to load the image fine but then causes
OpenSceneGraph to crash at a later point in a way that doesn't seem to
make much sense to me.

The crash occurs on line 163 of osgPlugins/ive/statset.cpp on line
163. I have starred the call below that causes OpenSceneGraph to
crash. The actual part of the call that crashes is the
(osg::StateAttribute::OverrideValue)in->readInt(), inside the readInt
call. I'm not sure how to fix this call. An alternative solution would
be to store the images inside the ive file in a more compressed format
(aka jpeg). I'm not quite sure how hard that would be.

Any ideas would be appreciated.
Cheers!
Aaron

osgPlugins/ive/stateset.cpp

        // Read texture stateset mode.
        int nUnits = in->readInt();
        int unit;
        for(unit=0;unit<nUnits;unit++){
            size = in->readInt();
            for(i=0;i<size;i++){
                int mode = in->readInt();
                int value = in->readInt();
                setTextureMode(unit,(osg::StateAttribute::GLMode)mode,
(osg::StateAttribute::GLModeValue)value);
            }
        }

        // Read texture attributes.
        nUnits = in->readInt();
        for(unit=0;unit<nUnits;unit++)
        {
            size = in->readInt();
            for(i=0;i<size;i++)
            {
                osg::StateAttribute* attribute = in->readStateAttribute();
               **** setTextureAttribute(unit, attribute,
(osg::StateAttribute::OverrideValue)in->readInt());
            }
        }

        if ( in->getVersion() >= VERSION_0010 )
        {
            // Read uniforms
            size = in->readInt();
            for(i=0;i<size;i++)
            {
                osg::Uniform* uniform = in->readUniform();
                addUniform(uniform,
(osg::StateAttribute::OverrideValue)in->readInt());
            }
        }
    }


Code 1 added to osgDB/Registry.cpp:
     if (containsServerAddress(readFunctor._filename))
        {
                serverName = getServerAddress(readFunctor._filename);
        serverFile = getServerFileName(readFunctor._filename);
        osg::notify(osg::INFO)<<"Contains sever address :
"<<serverName<<std::endl;
        osg::notify(osg::INFO)<<"         file name on server :
"<<serverFile<<std::endl;
                netFile = true;
        }
        else if(!readFunctor._options->getDatabasePathList().empty()) {
                std::string firstDatabasePath =
readFunctor._options->getDatabasePathList().front();
                std::string::size_type pos_col = 
firstDatabasePath.find_first_of(':');
                std::string::size_type pos_slash = 
firstDatabasePath.find_first_of('/');
                if((pos_col != std::string::npos) && (pos_slash == 
std::string::npos))
                {
                  serverName = firstDatabasePath.substr(0, pos_col);
                  serverFile = firstDatabasePath.substr(pos_col+1,
firstDatabasePath.size()-1) + "/";
          serverFile += readFunctor._filename;
                  netFile = true;
                }
        }
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to