Joined: 19 Jan 2018
|Posted: Sat Mar 10, 2018 4:16 am Post subject:
Undocking WIN32 causes problems
I am running my OSG scene in a WIN32 application. I hooked it up to the window using the following code and it works great. When I resize the window the scene resizes perfectly. However, when I undock the window from the parent form the OSG scenes goes black and I lose all further contact. Has anybody had any experience with OSG running in a windows application?
HWND hHwnd = (HWND)handle;
osg::ref_ptr<osg::Referenced> windata = new osgViewer::GraphicsWindowWin32::WindowData(hHwnd);
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->x = 0;
traits->y = 0;
traits->width = rect.right - rect.left;
traits->height = rect.bottom - rect.top;
traits->windowDecoration = false;
traits->doubleBuffer = true;
traits->sharedContext = 0;
traits->inheritedWindowData = windata;
Any hints or examples would be most welcome!
Many thanks for your help!!