[osg-users] Undocking WIN32 causes problems

Adrian Jelffs adrian.jelffs at makai.com
Fri Mar 9 20:16:20 PST 2018


Hello,

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?

	RECT rect;
	HWND hHwnd = (HWND)handle;

	GetWindowRect(hHwnd, &rect);

	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!!

Adrian

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73066#73066







More information about the osg-users mailing list