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 field of view of second slave camera?


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General [forum]
View previous topic :: View next topic  
Author Message
kefaline
Newbie


Joined: 04 Oct 2017
Posts: 2

PostPosted: Wed Oct 04, 2017 1:29 pm    Post subject:
How to set field of view of second slave camera?
Reply with quote

Hi,

I have problem to set field of view od second slave camera. I used it like lens, but when I on lens camera, distance of my "grapf" is incorect. My lens camera is smaler as you can see in the pic.



Lens option:
osg::ref_ptr<osg::Camera> lensCamera = new osg::Camera;
lensCamera->setCullMask(0x2);
lensCamera->setGraphicsContext(viewerWidget >getGraphicsWindow());
lensCamera->setViewport(new osg::Viewport((viewerWidget->width()/4),(viewerWidget->height()/4),viewerWidget->width()/2,viewerWidget->height()/2));
lensCamera->setReferenceFrame(osg::Transform::RELATIVE_RF);
viewerWidget->addSlave(lensCamera.get(), osg::Matrix(), osg::Matrix(), true);


I tried something like this : viewerWidget->addSlave(lensCamera.get(), osg::Matrix::scale(2,2,2),osg::Matrixd()); but scale doesnt work. Anyone help me?


Thank you!

Cheers,
Milos
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 807

PostPosted: Thu Oct 05, 2017 8:20 am    Post subject:
How to set field of view of second slave camera?
Reply with quote

Hi Milos,
Quote:
Hi,

I have problem to set field of view od second slave camera. I used it like lens, but when I on lens camera, distance of my "grapf" is incorect. My lens camera is smaler as you can see in the pic.



Lens option:
osg::ref_ptr<osg::Camera> lensCamera = new osg::Camera;
lensCamera->setCullMask(0x2);
lensCamera->setGraphicsContext(viewerWidget >getGraphicsWindow());
lensCamera->setViewport(new osg::Viewport((viewerWidget->width()/4),(viewerWidget->height()/4),viewerWidget->width()/2,viewerWidget->height()/2));
lensCamera->setReferenceFrame(osg::Transform::RELATIVE_RF);
viewerWidget->addSlave(lensCamera.get(), osg::Matrix(), osg::Matrix(), true);

I tried something like this : viewerWidget->addSlave(lensCamera.get(), osg::Matrix::scale(2,2,2),osg::Matrixd()); but scale doesnt work. Anyone help me?

The second parameter of the addSlave is the translation offset. You need
to change your slave's frustum by scaling the projection:

viewerWidget->addSlave(lensCamera.get(),osg::Matrixd(),osg::Matrix::scale(2,2,1.0))

Cheers
Sebastian



Quote:


Thank you!

Cheers,
Milos

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72101#72101




Attachments:
http://forum.openscenegraph.org//files/goal_129.png
http://forum.openscenegraph.org//files/withlens_141.png
http://forum.openscenegraph.org//files/nolens_743.png






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


Joined: 04 Oct 2017
Posts: 2

PostPosted: Thu Oct 05, 2017 9:16 am    Post subject:
WORKS!
Reply with quote

Hi Sebastian,

it works, thank you very much.


Thank you!

Cheers,
Milos
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 [forum] 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 So what is the status of VR camera to... dglenn General 0 Mon Apr 09, 2018 10:51 pm View latest post
No new posts View coordinates of a 3D point arennuit General 5 Fri Mar 16, 2018 12:37 pm View latest post
No new posts Prevention of near plane culling whil... hartwigw General 3 Sat Mar 10, 2018 7:57 am View latest post
No new posts How to make isometric view jgarneau General [forum] 3 Thu Mar 08, 2018 4:33 pm View latest post
No new posts The importance of using Camera::setDr... robertosfield General 5 Wed Mar 07, 2018 9:57 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