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

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 Slave camera lighting with disabled m... ravidavi General 9 Tue Jan 09, 2018 1:06 am View latest post
No new posts Free camera manipulator Styx General 2 Sun Jan 07, 2018 8:06 am View latest post
No new posts Resizing an FBO camera with OSG 3.2.0 James Turner General 7 Fri Dec 08, 2017 9:07 pm View latest post
No new posts How to simulate camera distortion ? blackball General 3 Fri Dec 08, 2017 11:16 am View latest post
No new posts When gets the view matrix of a camera... wernerM General 2 Sat Nov 18, 2017 4:08 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