OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

MFC mdi child windows show the scene with different lighting


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
rposg
Newbie


Joined: 26 May 2017
Posts: 1

PostPosted: Fri May 26, 2017 6:37 pm    Post subject:
MFC mdi child windows show the scene with different lighting
Reply with quote

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
Back to top
View user's profile Send private message
makulis
Newbie


Joined: 19 Jan 2015
Posts: 18

PostPosted: Tue Jun 06, 2017 6:22 am    Post subject:
Reply with quote

Hi,

That is very strange. I'm using MFC and I haven't experienced that. Can you modify the OSG MFC Example to reproduce the problem and post it in the forum? I can have a look at it on my side. Unfortunately I am not able to reproduce the problem with the code you posted.
...

Thank you!

Cheers,
Lincoln
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Faster framerate under Windows debugger? Chris Hanson General 1 Fri Sep 08, 2017 3:52 pm View latest post
No new posts Display one scene, pick from another one arennuit General 8 Fri Sep 08, 2017 11:50 am View latest post
No new posts scene snapshot Trajce Nikolov NICK General 3 Wed Aug 30, 2017 6:39 am View latest post
No new posts memory issue about x-windows in Linux Alberto Luaces General 1 Tue Aug 01, 2017 4:38 pm View latest post
No new posts plugin_pdf on Windows 64 bit andxet Plugins [osgPlugins] 0 Fri Jul 28, 2017 2:32 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP