--- OpenSceneGraph-3.2.1/src/osgPlugins/ogr/ReaderWriterOGR.cpp 2012-03-22 04:36:20.000000000 +1100 +++ ../OpenSceneGraph-3.2.1/src/osgPlugins/ogr/ReaderWriterOGR.cpp 2015-06-25 17:53:58.462196833 +1000 @@ -134,11 +134,13 @@ virtual ReadResult readFile(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { - if (OGRSFDriverRegistrar::GetRegistrar()->GetDriverCount() == 0) - OGRRegisterAll(); + if (GDALGetDriverCount() == 0) + GDALAllRegister(); // Try to open data source - OGRDataSource* file = OGRSFDriverRegistrar::Open(fileName.c_str()); + //OGRDataSource* file = OGRSFDriverRegistrar::Open(fileName.c_str()); + GDALDataset *file; + file = (GDALDataset*) GDALOpenEx( fileName.c_str(), GDAL_OF_VECTOR, NULL, NULL, NULL ); if (!file) return 0; @@ -156,13 +158,14 @@ osg::Group* group = new osg::Group; - for (int i = 0; i < file->GetLayerCount(); i++) + for (int i = 0; i < GDALDatasetGetLayerCount(file); i++) { - osg::Group* node = readLayer(file->GetLayer(i), file->GetName(), useRandomColorByFeature, addGroupPerFeature); + OGRLayer* layer = (OGRLayer *)GDALDatasetGetLayer(file, i); + osg::Group* node = readLayer(layer, layer->GetName(), useRandomColorByFeature, addGroupPerFeature); if (node) group->addChild( node ); } - OGRDataSource::DestroyDataSource( file ); + GDALClose( file ); return group; }