Background for a transparent layer

classic Classic list List threaded Threaded
2 messages Options
slawowski slawowski
Reply | Threaded
Open this post in threaded view
|

Background for a transparent layer

Hi,

When I don't add any image layers to osgEarth planet in may application, the surface of the earth is white. But when I add one layer, which has transparent background (like Google labels), the earth is transparent - white background disappears. I know that this effect may be desirable in many cases, but I would like to keep the white background.

What is the best way to do it programmatically in my application? One solution I've tried is creating an artificial first layer which returns white images for every tile request. I created a class which inherits from TileSource and overrides createImage (which returns 1x1 white image) and createProfile methods. Then, I passed a new object of this class as a TileSource parameter in MapLayer constructor. Unfortunately, Map::addMapLayer function fails when I try to add the layer to my map - it seems that I should create my own driver - am I right?

Warning: Could not find plugin to read objects from file ".osgearth_".
[osgEarth] Warning: Could not load TileSource for driver
[osgEarth::Map] Could not initialize profile for layer __White layer__

For such a trivial TileSource creating a new driver seems to be going too far. How can I create a "white layer" or are there any better solutions for setting a non-transparent background on the earth?

Best regards,
Slawek
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Background for a transparent layer

Hi Slawek,

This was a bug. I have committed a fix, and added a sample "user TileSource" to the osgearth_toc sample application to demonstrate it. (You were doing the right thing, it was just an untested feature.)

Thanks. Glenn
Glenn Waldron / Pelican Mapping