OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

How to set the transparency for one of my terrain layers?


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
adrianj
Newbie


Joined: 19 Jan 2018
Posts: 14

PostPosted: Tue Feb 06, 2018 3:19 am    Post subject:
How to set the transparency for one of my terrain layers?
Reply with quote

Hello,

I am using osgEarth to overlay a survey map onto another map. The survey image is generated as a GeoTiff and draped across the base map. I would like the areas that have no data (white) to be transparent. How do I do this? So far my code is like this but it does nothing at all.

Code:
GDALOptions gdalOptImg;
gdalOptImg.url() = url;
gdalOptImg.noDataValue() = 0;

ImageLayerOptions layerOptions(name, gdalOptImg);
osg::Vec4ub *transparentColor = new osg::Vec4ub();
transparentColor->r() = 255.0f;
transparentColor->g() = 255.0f;
transparentColor->b() = 255.0f;
transparentColor->a() = 1.0;

layerOptions.transparentColor() = *transparentColor;
layerOptions.name() = name;
imageryLayer = new ImageLayer(layerOptions);


I have tried a trillion different combinations but none of them seem to do anything.

If you reply please provide a code example, or links to where I can read more information about this, not just an API. Some source code is worth a thousand words Smile

Many thanks for your help!
[/code]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts How to get height above terrain in la... smp General 2 Thu Dec 28, 2017 12:25 pm View latest post
No new posts Terrain Deformation as per Road Profile umesh VirtualPlanetBuilder [vpb] 0 Mon Dec 04, 2017 4:44 pm View latest post
No new posts Camera collision with terrain ht11 General [3rdparty] 0 Fri Oct 13, 2017 7:34 am View latest post
No new posts Continuous Terrain moet General 14 Sat Sep 16, 2017 7:51 pm View latest post
No new posts How to reduce the size of the terrain qiaokun VirtualPlanetBuilder [vpb] 0 Fri May 19, 2017 7:49 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP