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: 822

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 ReaderWriterCFG - offset for single c... Marcin Prus Submission 0 Fri Jul 06, 2018 11:27 am View latest post
No new posts osgOcean - Render to Texture Camera rob_ewbank osgOcean [osgOcean] 3 Wed Jul 04, 2018 11:27 am View latest post
No new posts osgviewer camera initial angle. Vagn General 1 Wed Jun 20, 2018 2:31 pm View latest post
No new posts Positioning a Camera relative to anot... Takarashy General 0 Thu May 24, 2018 8:27 am View latest post
No new posts Positioning an object based on the Vi... Takarashy General 0 Wed May 23, 2018 3:14 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