I have been attempting to upgrade my C++/CLI MDI application from OSG1.0 to
OSG2.0.  Currently I am using OSG1.0 to render to one of the MDI child
forms.  There are 2 problems I am having with

osgViewer::Viewer that do not occur when using osgProducer::Viewer.  Both
problems are related to my dual monitor setup.

First when I maximize the MDI child to fill the MDI parent frame, the
viewport seems to be set to cover both monitors even though the MDI parent
may only cover a fraction of one monitor.
I have experienced similar dual monitor issues with the OSG2.0 osgwiewer
application.  It starst out in full screen mode on both of my monitors
(whereas in OSG1.0 the full screen only filled 1 monitor).  Also when I
exit full screen mode I get 2 windows (whereas in OSG1.0 I only got 1).

My second problem: when I move my application to my other monitor the
textures disappear and the program crashes.

Neither of these problems occured with OSG1.0 using osgProducer::Viewer.


**OSG1.0 code using osgProducer::Viewer
MDI_CHILD_CONSTRUCTOR
  m_viewer = new osgProducer::Viewer();
  m_viewer->setUpViewer(osgProducer::Viewer::TRACKBALL_MANIPULATOR |
osgProducer::Viewer::STATE_MANIPULATOR |
        osgProducer::Viewer::VIEWER_MANIPULATOR |
osgProducer::Viewer::HEAD_LIGHT_SOURCE);

  m_viewer->setSceneData(m_sceneRoot);

  // Set the render surface to pnlFill
  m_viewer->getCamera(0)->getRenderSurface()->setWindow((HWND)pnlFill->
Handle.ToInt32()); // THIS WORKS GREAT
  m_viewer->realize();



**OSG2.0 code using osgViewer::Viewer modeled after osgviewerMFC example
MDI_CHILD_CONSTRUCTOR
  SetStyle(ControlStyles::OptimizedDoubleBuffer, true);
  SetStyle(ControlStyles::UserPaint, true);
  SetStyle(ControlStyles::AllPaintingInWmPaint, true);;

  m_viewer = new osgViewer::Viewer();


  HWND hwnd = (HWND)pnlFill->Handle.ToPointer();
  RECT rect;
  ::GetWindowRect(hwnd, &rect);

  // Init the Windata Variable that holds the handle for the Window to
display OSG in.));
  osg::ref_ptr<osg::Referenced> windata = new
osgViewer::GraphicsWindowWin32::WindowData(hwnd);

  // Init the GraphicsContext Traits
  osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
osg::GraphicsContext::Traits;

  // Setup the traits parameters
  traits->inheritedWindowData = windata;
  traits->setInheritedWindowPixelFormat = true;
  traits->windowDecoration = false;
  traits->doubleBuffer = true;
  traits->sharedContext = 0;
  traits->supportsResize = true;

  traits->x = 0;
  traits->y = 0;
  traits->width = rect.right - rect.left;
  traits->height = rect.bottom - rect.top;

  // Create the Graphics Context
  osg::ref_ptr<osg::GraphicsContext> gc =
osg::GraphicsContext::createGraphicsContext(traits.get());

  // Init a new Camera (Master for this View)::
  osg::ref_ptr<osg::Camera> camera = new osg::Camera;

  // Assign Graphics Context to the Camera
  camera->setGraphicsContext(gc.get());
  camera->setViewport(new osg::Viewport(traits->x, traits->y, traits->
width, traits->height));

  // Add the Camera to the Viewer
  m_viewer->addSlave(camera.get());


  m_viewer->setSceneData(m_sceneRoot);
  m_viewer->realize();



On another topic, I recently downloaded some OSG2.8.1 dlls and the dll
names are all prefixed with "osg55-".  What's that all about?


Thanks,
    Jeff



This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery.
NOTE: Regardless of content, this e-mail shall not operate to bind CSC to
any order or other contract unless pursuant to explicit written agreement
or government initiative expressly permitting the use of e-mail for such
purpose.

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to