[osg-users] determining new size of rendering window after a user resizing

Robert Osfield robert.osfield at gmail.com
Thu Mar 31 08:21:08 PDT 2016

Hi Robert,

>From the include/osgViewer/GraphicsWindow header there is the method:

        /** Get the window's position and size.*/
        virtual void getWindowRectangle(int& x, int& y, int& width, int&
height) { if (_traits.valid()) { x = _traits->x; y = _traits->y; width =
_traits->width; height = _traits->height; }  }

You can also get the GrahicsContext::Traits object
(GraphicsContext::getTraits()) and get the x,y, width and height values
from it.  Note, osgViewer::GraphicsWindow subclassed from


On 31 March 2016 at 16:08, Robert Kiser <rkiser at k2engineeringinc.com> wrote:

> Hello All
> First, I apologize profusely if I am asking a newbie question with an
> obvious answer.  I am a technical software developer w/ 30 years experience
> in other languages (FORTRAN, Assembler, VB.Net) but have only very recently
> been exposed to C++ and OSG.
> My question is: how (on a Windows system) can I determine the size of the
> rendering window after the user has resized it?  (I was wanting this info
> so I could set the rendering window back to the desired size the next time
> the user ran the program.)  I thought that there would be a quick and
> simple answer, but for some reason I can't seem to some up with it.
> I've done numerous google searches along the lines of: "OpenSceneGraph get
> window size",  "OpenSceneGraph get window width", etc. to no avail.
> I did find a hit talking about a class called Producer which I am
> understanding is deprecated from an older version of OSG.  I am presently
> using OSG 3.4.0 and was wanting a solution for that version.
> Thanks in advance for your help as I delve deeper into the exciting world
> of OSG.
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=66691#66691
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160331/cdaa0fdd/attachment-0003.htm>

More information about the osg-users mailing list