Hi,
I have a MFC MDI osg project. Every child window has the same model and
ligthing and teh sequence of initialization. I have attached a screenshot to
show how it looks as we open more child windows.
The structure of the project is as below.
View.cpp
doc.cpp
mainframe.cpp
childframe.cpp
myosgviewer.cpp
The sequence of operations are as below.
A new instance of myOSGViewer is created in OnCreate() of the view class.
In OnInitialUpdate() of view class
myOSGViewer is initialized as below.
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator =
new osgGA::KeySwitchMatrixManipulator;
keyswitchManipulator->addMatrixManipulator('1', "Trackball", new
osgGA::TrackballManipulator());
keyswitchManipulator->addMatrixManipulator('2', "Flight", new
osgGA::FlightManipulator());
keyswitchManipulator->addMatrixManipulator('3', "Drive", new
osgGA::DriveManipulator());
keyswitchManipulator->addMatrixManipulator('4', "Terrain", new
osgGA::TerrainManipulator());
keyswitchManipulator->addMatrixManipulator('5', "Orbit", new
osgGA::OrbitManipulator());
keyswitchManipulator->addMatrixManipulator('6', "FirstPerson", new
osgGA::FirstPersonManipulator());
keyswitchManipulator->addMatrixManipulator('7', "Spherical", new
osgGA::SphericalManipulator());
viewer = new osgViewer::Viewer();
viewer->setCameraManipulator(keyswitchManipulator.get());
viewer->addEventHandler(new osgViewer::WindowSizeHandler);
viewer->addEventHandler(new osgViewer::StatsHandler);
mEvents = new KeyboardEventHandler(this);
viewer->addEventHandler(mEvents);
viewer->setLightingMode(osg::View::HEADLIGHT);
ConstructModel(); //scene is created. light transform is also created
added to the scene graph
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
osg::GraphicsContext::Traits;
osg::ref_ptr<osg::Referenced> windata = new
osgViewer::GraphicsWindowWin32::WindowData(m_hWnd);
osg::GraphicsContext* gc =
osg::GraphicsContext::createGraphicsContext(traits.get());
osg::ref_ptr<osg::Camera> camera = viewer->getCamera();
camera->setGraphicsContext(gc);
camera->setViewport(new osg::Viewport(traits->x, traits->y,
traits->width, traits->height));
camera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
camera->setClearColor(osg::Vec4f(0.2f, 0.2f, 0.4f, 1.0f));
camera->setProjectionMatrixAsPerspective(
30.0f, static_cast<double>(traits->width) /
static_cast<double>(traits->height), 1.0, 1000.0);
viewer->setCamera(camera.get());
viewer->setCameraManipulator(keyswitchManipulator.get());
viewer->realize();
viewer->getCameraManipulator()->setHomePosition(eyeP, centreP, upP);
viewer->home();
Then
mThreadHandle1 = new CRenderingThread1(myOSGViewer);
mThreadHandle1->start();
For every OnFileNew the above steps happen. I find that the child windows dont
have the same level of brightness. I have attached a screenshot of the problem.
Hope I have been clear in putting the problem. In case any more detail is
required I will be happy to provide. Any thought or idea is will be appreciated.
...
Thank you!
Cheers,
Rakesh
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70986#70986
Attachments:
http://forum.openscenegraph.org//files/mdiscreen1_228.jpg
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org