[osg-users] viewport is changing after huge sized object ; updating only visible nodes

Robert Osfield robert.osfield at gmail.com
Mon Mar 28 04:47:10 PDT 2016

Hi Andrey,

On 22 March 2016 at 09:30, Andrey Perper <TheAndreyp at gmail.com> wrote:

> Hey guys!!!!!!!
> 1) My scene is set like it is always fits in camera (i guess it is
> osg-default). If i add huge sized object - i see all scene (camera flies
> away), but my viewpoint must stay old.
> How to fix that ?

First thing is to clarify the language.  In OpenGL and therefore the OSG
the viewport (glViewport / osg::Viewport) is the rectangular region of the
window that the rendering fills in.

What you are describing is the Viewer's CameraManipulator changing it's
view matrix, which wrap up the eye, center and up direction) so the whole
scene is encompassed.  This reset of the CameraManipulator happens in the
home() method.  For most applications that just won't to use one of the
standard CamaeraManipualators (found in the osgGA library) re-positing the
view is appropriate.

For your specific usage case it sounds like this is not desired.
CameraManipulators in the OSG are just optional so you can set the View's
master Camera view matrix directly, or for you to create your own custom
CameraManipulator, or to subclass from one of the osgGA CameraManipulator's
and override the methods that you want to modify the behaviour of.

I can't say what approach is most appropriate as I know too little about
the specifics of your application.

> 2) I have dozen of nodes that are updating in my addUpdateCallback functor
> anyway (whether node is visible or not), but i would want to do that only
> if node is visible. Node has osg::Geode drawables.
> How to fix that ?

I'm not clear on what you mean here.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160328/3cfef26d/attachment-0003.htm>

More information about the osg-users mailing list