I'm attempting to load a KML/KMV file and convert it to IVE.  Well, the DAE 
plugin works great and the KML plugin for osgEarth works great, too.  Further, 
when I use osgViewere.run() after setting my new node in the scene I can see 
the node in all of its 3D glory.  In other words, from load to display 
everything looks great and I have no issues.

When I try to save the node I get this error on the console:
image C:\Workspace\OpenSceneGraph\build\bin\models\untitled\texture.jpg' 256    
 128
Error writing IVE image: StateSet::write(): Unknown StateAttribute: 
VirtualProgram

The file writes out to an IVE file as an uncompressed IVE stream or so the 
output claims.  When I try to read in the file I just saved I get an error 
saying that osg couldn't find a plugin to read the IVE file.  Well, garbage in 
garbage out.

What is annoying is that if I have a KML without a texture there is no issues.  
Even with the issue I can display the 3d object if I put it in a viewer.  Also, 
if I try to load and save any other type of file there is no issue.  I can go 
from IVE to OSG to 3ds etc without a hitch.  Any ideas would be appreciated.

Please note I assume this is an OSG question since I'm having an issue with the 
write node function.  If you guys believe this is better handled on the 
osgEarth forum let me know.

Thanks,
soulsabr


Code:

bool Converter::initialize()
{
  // Assume failure; only set true if everything succeeds
  bool succeeded = false;

  // Read in the .earth file.
  _earthModel = osgDB::readNodeFile("nodata.earth");

  // Check for a successful read
  if(_earthModel != NULL)
  {
    // Create the mapnode needed for reading KML/KMZ files
    _mapNode = osgEarth::MapNode::findMapNode(_earthModel);

    if(_mapNode != NULL)
    {
      // Initialization succeeded
      succeeded = true;
    }
  }

  return succeeded;
}

bool Converter::convert(std::string aFileName)
{
  //osgEarth::URI uri(aFileName);
  osgEarth::URI uri("C:\\Workspace\\OpenSceneGraph\\build\\bin\\doc.kml");

  std::string ext = osgDB::getLowerCaseFileExtension(uri.full());
  bool val = (ext == "kmz");

  osg::Node* node = 
    osgEarth::Drivers::KML::load(uri,
                                 _mapNode,
                                 osgEarth::Drivers::KMLOptions());


if(node != NULL)
  {
    osgDB::writeNodeFile(*node, "test.ive");
    node = 
osgDB::readNodeFile("C:\\Workspace\\OpenSceneGraph\\build\\bin\\test.ive");
  }

  osgViewer::Viewer* viewer = new osgViewer::Viewer();
  viewer->setSceneData(node);
  viewer->run();

  return true;
}





------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=53299#53299





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to