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

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 osg::Group Child Problem Latha Rani General 4 Tue Jun 13, 2017 1:16 pm View latest post
No new posts scene object not receiving/casting sh... Meldryt General 0 Thu May 11, 2017 8:01 am View latest post
No new posts Crash on Windows 10 with a Display Li... efson General 2 Thu Apr 27, 2017 9:03 am View latest post
No new posts Show children with hidden parent YuraIU02 General 3 Wed Apr 26, 2017 6:11 am View latest post
No new posts Support for Windows Universal Platform tomhog General 10 Fri Apr 21, 2017 11:07 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