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 

Add multiple OverlayNode.


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


Joined: 09 Jun 2019
Posts: 1

PostPosted: Sun Jun 09, 2019 2:30 am    Post subject:
Add multiple OverlayNode.
Reply with quote

Hi,

How do I add multiple OverlayNode to a scene? I read the post "Viewer with 2 overlay nodes", using setOverlayTextureUnit to distinguish each OverlayNode, but this is limited by the number of multiple texture units supported. On my desktop, the number of multiple texture units supported by the graphics card is 4, and the maximum available texture unit is 3, which means I can only add 3 OverlayNode to the scene at most.

Code:

osg::ref_ptr<osg::Node> baseModel = createBase(osg::Vec3(center.x(), center.y(), baseHeight),radius);
osg::ref_ptr<osg::Node> movingModel = createMovingModel(center,radius*0.8f);

osg::ref_ptr<osg::Node> baseModel2 = createBase(osg::Vec3(center.x() + radius * 2, center.y() + radius * 0, baseHeight), radius);
osg::ref_ptr<osg::Node> movingModel2 = createMovingModel(osg::Vec3(center.x() + radius * 2, center.y() + radius * 0, center.z()), radius*0.8f);

if (overlay)
{
osgSim::OverlayNode* overlayNode = new osgSim::OverlayNode(technique);
overlayNode->setContinuousUpdate(true);
overlayNode->setOverlaySubgraph(movingModel);
overlayNode->setOverlayBaseHeight(baseHeight-0.01);
overlayNode->setOverlayTextureUnit(1);//default
overlayNode->addChild(baseModel);
root->addChild(overlayNode);

osgSim::OverlayNode* overlayNode2 = new osgSim::OverlayNode(technique);
overlayNode2->setContinuousUpdate(true);
overlayNode2->setOverlaySubgraph(movingModel2);
overlayNode2->setOverlayBaseHeight(baseHeight - 0.01);
overlayNode->setOverlayTextureUnit(2);
overlayNode2->addChild(baseModel2);
root->addChild(overlayNode2);
}
else
{
root->addChild(baseModel);
root->addChild(baseModel2);
}

root->addChild(movingModel);
root->addChild(movingModel2);


Thank you!

Cheers,
Simen
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 Running multiple (independent) viewer... Aneoshun General 2 Wed May 22, 2019 4:49 pm View latest post
No new posts osgText crash with multiple Viewers ravidavi General 3 Tue Dec 18, 2018 8:50 am View latest post
No new posts Render multiple PRE_RENDER cameras to... ivar General 3 Tue Nov 13, 2018 3:41 pm View latest post
No new posts Rendering multiple screens njr3 General 1 Wed Oct 31, 2018 8:46 pm View latest post
No new posts CompositeViewer with multiple view, a... Angel General 3 Tue Aug 28, 2018 1:15 pm 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