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 

Camera resize vs setViewport


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


Joined: 06 Nov 2015
Posts: 34

PostPosted: Fri Feb 24, 2017 3:13 am    Post subject:
Camera resize vs setViewport
Reply with quote

Hi all,

In osg::Camera, there exist two resize functions: Camera::resize(width, height) and Camera::setViewport(x, y, width, height). I'm confused conceptually as to when to use which one. Some examples use resize (osgdistortion), whereas others use setViewport (osghud).

Looking at the Camera.cpp code, it looks like resize() calls setViewport(), but why does it not then accept x/y position arguments? For example, I have a CompositeViewer with multiple Views. Each View has a master & slave (HUD) camera, which are set up in a grid format on the GraphicsContext. I initialize each master/slave combo using setViewport() but I can't use Camera::resize() since I can't pass it the x/y coordinates.

What am I missing here? When is it appropriate to call Camera::resize() instead of Camera::setViewport()?

Thanks,
Ravi
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 10892

PostPosted: Fri Feb 24, 2017 11:33 am    Post subject:
Camera resize vs setViewport
Reply with quote

Hi Ravi,

The resize is primarily for responding to window resize events where
you need to adjust the viewport and projection matrix to provide
sensible on screen behaviour.

The setViewport() method just sets the viewport, it doesn't try to do
anything with any other paramters such as the projection matrix.

Robert.

On 24 February 2017 at 03:13, Ravi Mathur <> wrote:
Quote:
Hi all,

In osg::Camera, there exist two resize functions: Camera::resize(width, height) and Camera::setViewport(x, y, width, height). I'm confused conceptually as to when to use which one. Some examples use resize (osgdistortion), whereas others use setViewport (osghud).

Looking at the Camera.cpp code, it looks like resize() calls setViewport(), but why does it not then accept x/y position arguments? For example, I have a CompositeViewer with multiple Views. Each View has a master & slave (HUD) camera, which are set up in a grid format on the GraphicsContext. I initialize each master/slave combo using setViewport() but I can't use Camera::resize() since I can't pass it the x/y coordinates.

What am I missing here? When is it appropriate to call Camera::resize() instead of Camera::setViewport()?

Thanks,
Ravi

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








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


Joined: 06 Nov 2015
Posts: 34

PostPosted: Fri Feb 24, 2017 3:18 pm    Post subject:
Re: Camera resize vs setViewport
Reply with quote

Thanks Robert. But still, why does resize() not accept x/y arguments? As it is now, it cannot be used with CompositeViewer where Cameras are distributed around the window with various Viewports. Is it just intended for use with the regular osg::Viewer?

robertosfield wrote:
Hi Ravi,

The resize is primarily for responding to window resize events where
you need to adjust the viewport and projection matrix to provide
sensible on screen behaviour.

The setViewport() method just sets the viewport, it doesn't try to do
anything with any other paramters such as the projection matrix.

Robert.
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 10892

PostPosted: Fri Feb 24, 2017 3:36 pm    Post subject:
Camera resize vs setViewport
Reply with quote

On 24 February 2017 at 15:18, Ravi Mathur <> wrote:
Quote:
Thanks Robert. But still, why does resize() not accept x/y arguments? As it is now, it cannot be used with CompositeViewer where Cameras are distributed around the window with various Viewports. Is it just intended for use with the regular osg::Viewer?

It's a resize of the window.


------------------
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 How to get the camera's roll pitch an... xdfanfan General 1 Sat Apr 01, 2017 8:43 am View latest post
No new posts Multisampled FBO camera with shared d... HonzaS General 0 Fri Mar 17, 2017 3:19 pm View latest post
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 About separate rendering of a slave c... wernerM General 0 Tue Mar 07, 2017 3:14 pm View latest post
No new posts How to add a camera Nico Kruithof General 5 Tue Feb 21, 2017 8:21 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