[osg-users] How to resize/move existing OSG window dynamically?

Robert Osfield robert.osfield at gmail.com
Thu May 30 23:54:19 PDT 2019


Hi Mike,

The EventQueue's windowResize(..) method is for informing the OSG's
event system that a window has already been resized, i.e. that a
resize has happened and now all the event handles who are interested
in this event can handle it.

If you want to move a window then you need to set the new window
position and dimensions directly on the window you want to move.  The
osgViewer::GraphicsWindow class that is responsible for this has the
method:

        /** Set the window's position and size.*/
        void setWindowRectangle(int x, int y, int width, int height)

Cheers,
Robert.

On Thu, 30 May 2019 at 20:42, Mike Greene <mgreene at hiwaay.net> wrote:
>
> Hi,
>
> I have an example where I create an OSG window. I need to be able to move or resize it after creation through code. I have tried something like this:
>
>
> Code:
>
> while (!viewer->done()) {
>                 viewer->frame();
>
> if (bConditionMet) viewer->getEventQueue()->windowResize(newX, newY, newWidth, newHeight);
> }
>
>
>
>
> But this seems to have no effect. Do I need to reset the traits on the graphicsContext?
>
> Thank you!
>
> Cheers,
> Mike[/code]
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=76156#76156
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


More information about the osg-users mailing list