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

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 Camera collision with terrain ht11 General [3rdparty] 0 Fri Oct 13, 2017 7:34 am View latest post
No new posts Rotating Slave Camera Views Jim Perkins General 1 Tue Sep 26, 2017 7:57 pm View latest post
No new posts How to access the view parameters fro... Miguel General 1 Fri Sep 22, 2017 5:31 pm View latest post
No new posts Is Camera should be a MatrixTransform? mp3butcher General 0 Mon Sep 18, 2017 4:42 pm View latest post
No new posts Passing input to viewer/camera (using... antiro42 General 2 Sat Sep 16, 2017 11:07 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