[osg-users] [3rdparty] Use PNG as texture for terrain in osgEarth
Chris Hanson
xenon at alphapixel.com
Mon Jan 7 14:51:44 PST 2019
Ok, so if you're adding an image layer programmatically, you *don't *want
to add a .earth XML file.
It should probably look something like
// Add an imagery layer
{
GDALOptions gdal;
gdal.url() = "br.png";
osg::ref_ptr<ImageLayer> layer = new ImageLayer( "NASA",
tms );
layer->setOpacity(0.5);
printf("\nOpacity: %.2f\n",layer->getOpacity());
map->addLayer( layer );
}
The GDAL loader handles almost all local-disk data loading. The TMS loader
you were trying to use is for loading data from an Internet Tile Map
Server. The GDAL loader loads either elevation or imagery data.
Keep in mind, if you are using br.png, there isn't any positional
information in a PNG file to tell osgEarth WHERE on the Earth to place that
PNG file. Certain file types like TIFF can have extra data (called GeoTIFF)
that specify this positioning. So, consider what you're trying to do here
-- it may not give you errors but you may not see br.png placed anywhere
useful on your map.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20190107/a4142509/attachment.html>
More information about the osg-users
mailing list