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 

Change Perspective to Orthogonal View


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


Joined: 11 Jun 2015
Posts: 14

PostPosted: Mon Mar 06, 2017 12:51 am    Post subject:
Change Perspective to Orthogonal View
Reply with quote

Hi,

I like to change the current perspective view of my camera to an orthogonal projection, keeping the same position. How can I do this?

My current code of perspective camera:

Code:

_viewer->getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
_viewer->getCamera()->setProjectionMatrixAsPerspective(fovY * 180.0 / M_PI, aspectRatio, 0.1, 1000);



...

Thank you!

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


Joined: 18 Mar 2009
Posts: 10791

PostPosted: Mon Mar 06, 2017 8:44 am    Post subject:
Change Perspective to Orthogonal View
Reply with quote

Hi Rômulo,

You can simply via the Camera::setProjectionMatrixAsOrtho(...) method.
Have a look at the include/osg/Camera header. Also have a look at
gluOrtho docs online to understand the parameters used and mean as the
OSG uses a 1:1 mapping in terminology and implementation.

Robert.

On 6 March 2017 at 00:51, Rômulo Cerqueira <> wrote:
Quote:
Hi,

I like to change the current perspective view of my camera to an orthogonal projection, keeping the same position. How can I do this?

My current code of perspective camera:


Code:

_viewer->getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
_viewer->getCamera()->setProjectionMatrixAsPerspective(fovY * 180.0 / M_PI, aspectRatio, 0.1, 1000);





...

Thank you!

Cheers,
Rômulo

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








------------------
Post generated by Mail2Forum
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 Is it possible to temporarily redirec... wernerM General 3 Thu Mar 09, 2017 2:13 pm View latest post
No new posts [3rdParty/maybe OSG general] osgoculu... Trajce Nikolov NICK General 2 Wed Mar 01, 2017 11:24 pm View latest post
No new posts How to change terrain elevation manua... vinothrajendran4 VirtualPlanetBuilder [vpb] 1 Wed Jan 04, 2017 5:00 am View latest post
No new posts View::computeIntersections Trajce Nikolov NICK General 1 Mon Jan 02, 2017 5:33 pm View latest post
No new posts Material Properties to Change the Nor... romulogcerqueira General 11 Fri Dec 23, 2016 2:48 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