[osg-users] MFC Fullscreen With Multiple Monitors

spowers at gdrs.com spowers at gdrs.com
Thu Jul 10 06:14:26 PDT 2008

Has no one run into this before? I've also tried creating a window in
MFC and using its WindowData object as the inherited window data object.
That did not work either. Any tips from anyone that has done this

From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of
spowers at gdrs.com
Sent: Monday, July 07, 2008 11:41 AM
To: osg-users at lists.openscenegraph.org
Subject: [osg-users] MFC Fullscreen With Multiple Monitors
I'm having a problem with inheriting window data from an MFC window in
OSG 2.2.
When I run an application with a dual monitor display the application
runs and OSG starts but it starts in fullscreen mode rather than
inheriting the MFC window size and location.
When I run the same application on the same machine but with only a
single monitor the OSG inherits the MFC window correctly.
Is there something that I'm missing?
Here is the code I use to create the window (borrowed from the MFC
viewer example):
       // Local Variable to hold window size data
       RECT rect;
       // Create the viewer for this window
       mViewer = new osgViewer::Viewer();
       //// Add a Stats Handler to the viewer
       mViewer->addEventHandler(new osgViewer::StatsHandler);
       //// Get the current window size
       ::GetWindowRect(m_hWnd, &rect);
       //// Init the GraphicsContext Traits
       osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
       //// Init the Windata Variable that holds the handle for the
Window to display OSG in.
       osg::ref_ptr<osg::Referenced> windata = new
       // Setup the traits parameters
       traits->x = 0;
       traits->y = 0;
       traits->width = rect.right - rect.left;
       traits->height = rect.bottom - rect.top;
       traits->windowDecoration = false;
       traits->doubleBuffer = true;
       traits->sharedContext = 0;
       traits->setInheritedWindowPixelFormat = true;
       traits->inheritedWindowData = windata;
       // Create the Graphics Context
       osg::GraphicsContext* gc =
       // Init a new Camera (Master for this View)
       _camera = new osg::Camera;
       // Assign Graphics Context to the Camera
       // Set the viewport for the Camera
       _camera->setViewport(new osg::Viewport(traits->x, traits->y,
traits->width, traits->height));
       // Add the Camera to the Viewer
       // Add the Camera Manipulator to the Viewer
       // Set the Scene Data
       // Realize the Viewer
       //mViewer->getCamera()->setViewport(traits->x, traits->y,
traits->width, traits->height);
Thanks -Steve 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080710/10ccb2a4/attachment-0003.htm>

More information about the osg-users mailing list