[osg-users] embedding osg::viewer

Noè Murr nosba95 at yahoo.com
Sat Aug 31 13:02:34 PDT 2019


Hi,

I'm answering my own question:

To move the area where my scene is drawn I have to set 
the viewport of the camera. 

So if I add this line to the configuration of osgviewerSDL example I can change the position of the scene in the window:


Code:


viewer.getCamera()->setViewport(myX, myY, myWidth, myHeight);





Now I've got two more sneaky problems.

First I can't understand what are the responsibility of this method:
osgViewer::GraphicsContext::resized;

The documentation says:
resized implementation, by default resizes the viewports and aspect ratios the cameras associated with the graphics Window. 

It effectively does resize the viewport but it does not move it? so why am I passing it an X and Y?

Second problem:

If I create a osgviewer::GraphicsEmbeddedWidnow 800x600 and I set a viewport, for the camera of the viewer, of 800x800. The viewer.frame() method draws on an area of 800x800 that is greater than the area of the embedded window...

So what's the meaning of giving the x, y, width and height value to the window?

Cheers,
Noè[/list]

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







More information about the osg-users mailing list