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 

AddSlave & removeSlave camera seem inconsistent


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


Joined: 28 Oct 2015
Posts: 21

PostPosted: Wed Apr 10, 2019 6:52 pm    Post subject:
AddSlave & removeSlave camera seem inconsistent
Reply with quote

I am trying to use the HUD sample code to do on screen list selection. The information in the list changes with each model loaded so a static HUD will not work.

addSlave takes in a osg::Camera instance and returns a bool. removeSlace takes in an integer presumably an index to a list of cameras.

I also have a HUD type of status bar across the bottom of the screen. When the user views multiple models, slave cameras are added and removed when the user is finished with the list also removes the status bar camera.

Is there a way to programmatically determine the index when a slave camera is added to insure the correct one is removed?


Thank you!

Cheers,
Bruce
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12321

PostPosted: Thu Apr 11, 2019 3:49 pm    Post subject:
AddSlave & removeSlave camera seem inconsistent
Reply with quote

Hi Bruce,


On Thu, 11 Apr 2019 at 00:37, Bruce Clay <> wrote:
Quote:
Is there a way to programmatically determine the index when a slave camera is added to insure the correct one is removed?

I just looked t include/osg/View header and found :

unsigned int findSlaveIndexForCamera(osg::Camera* camera) const;

Another approach you could take would be to add all the slave Camera
you want and then enable/disable then by setting the respective Camera
NodeMask to 0x0 and 0xffffffff to toggle it off/on respectively. This
way you could avoid needing to add/remove them.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
bclay
User


Joined: 28 Oct 2015
Posts: 21

PostPosted: Thu Apr 11, 2019 5:08 pm    Post subject:
Reply with quote

Robert:
Thanks for the reply. The first method you mentioned should do the trick.

Since we don't know the models that the user will load and the DOFTransform names or switch names are what is displayed in the menu we can not pre-build the menus.

Another thing I was thinking about is to keep the same cameras but remove their contents and reload them. I don't know which is the best way but I can try both now that I have your information.

Thank you!

Cheers,
Bruce
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 Projection matrix with camera looking... AlexSavo General 0 Thu Jul 25, 2019 2:34 am View latest post
No new posts osgVIEWER problem camera skehal General 1 Tue Jul 23, 2019 9:17 am View latest post
No new posts Keeping camera fixed alasca General 3 Fri May 31, 2019 10:08 am View latest post
No new posts FPS camera Ligvest General 0 Mon Apr 01, 2019 1:03 pm View latest post
No new posts First Person Camera disable inertial ... Ligvest General 3 Thu Mar 28, 2019 1:01 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