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: 6

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
User


Joined: 19 Jan 2015
Posts: 20

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
rposg
Newbie


Joined: 26 May 2017
Posts: 6

PostPosted: Tue Oct 31, 2017 2:49 pm    Post subject:
Reply with quote

Hi,
Revisiting this problem. For a better idea of the problem I am attaching another screenshot where both child windows are open. You can also see the
stats have been enabled. We see that one window is running at a frame rate of 17 while the other is running close to zero. Why would this happen.
My machine is a i5 with 4gb of ram.
Regards,
Rakesh

@makulis - I will try to create a minimal project which demonstrates this problem.
Thanks

makulis wrote:
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
rposg
Newbie


Joined: 26 May 2017
Posts: 6

PostPosted: Wed Nov 01, 2017 10:58 am    Post subject:
Reply with quote

I am attaching the openscenegraph DEBUG_INFO. Two log files were created by overriding NotifyHandler. Each thread wrote a different log file.
Attached are both the log files, one for each MDI child window.
Any thought or direction will be helpful.
Regards,
Rakesh

rposg wrote:
Hi,
Revisiting this problem. For a better idea of the problem I am attaching another screenshot where both child windows are open. You can also see the
stats have been enabled. We see that one window is running at a frame rate of 17 while the other is running close to zero. Why would this happen.
My machine is a i5 with 4gb of ram.
Regards,
Rakesh

@makulis - I will try to create a minimal project which demonstrates this problem.
Thanks

makulis wrote:
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
makulis
User


Joined: 19 Jan 2015
Posts: 20

PostPosted: Wed Nov 08, 2017 9:06 am    Post subject:
Reply with quote

Hi Rakesh,

If you want us to help you please reproduce the scenario by posting a minimal project (like modifying the MFC example) like I asked you to. The sooner you do that the sooner you will get help. Any other attempt like posting log files you are really just wasting time.
...

Thank you!

Cheers,
Lincoln
Back to top
View user's profile Send private message
makulis
User


Joined: 19 Jan 2015
Posts: 20

PostPosted: Wed Nov 08, 2017 9:09 am    Post subject:
Reply with quote

Hi Rakesh,

If you are not willing to put in the effort to reproduce the scenario then maybe you don't really want help.
...

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 Correct way to modify scene graph [SE... Thamm, Russell General 5 Thu Nov 09, 2017 3:52 am View latest post
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


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