No one with insight on this? /Anders
On Fri, Mar 8, 2013 at 11:27 AM, Anders Backman <ande...@cs.umu.se> wrote: > Hi all. > > I have a small problem where I > use osg::GraphicsContext::createGraphicsContext to create a context for a > window-widget (in .NET), but I also use another piece of software that > use wglGetCurrentContext to check for context. > But wglGetCurrentContext() returns null for the context that OSG creates. > > My init method: > > bool GraphicsWindow::initOSG( HWND hwnd) > { > if (m_viewer.valid()) > return true; > > m_viewer = new osgViewer::Viewer(); > m_viewer->setThreadingModel( osgViewer::ViewerBase::SingleThreaded ); > m_root = new osg::Group; > m_viewer->setSceneData( m_root.get() ); > > > m_traits = new osg::GraphicsContext::Traits(); > m_traits->inheritedWindowData = new > osgViewer::GraphicsWindowWin32::WindowData( hwnd ); > m_traits->setInheritedWindowPixelFormat = true; > m_traits->doubleBuffer = true; > m_traits->windowDecoration = true; > m_traits->sharedContext = NULL; > m_traits->supportsResize = true; > > RECT rect; > ::GetWindowRect( hwnd, &rect ); > m_traits->x = 0; > m_traits->y = 0; > m_traits->width = rect.right - rect.left; > m_traits->height = rect.bottom - rect.top; > > m_graphicsContext = osg::GraphicsContext::createGraphicsContext( > m_traits.get() ); > > m_viewer->getCamera()->setGraphicsContext( m_graphicsContext.get() ); > m_viewer->getCamera()->setViewport( new osg::Viewport( 0, 0, > m_traits->width, m_traits->height ) ); > m_viewer->getCamera()->setProjectionMatrixAsPerspective(30.0f, > static_cast<double>(m_traits->width)/static_cast<double>(m_traits->height), > 1.0f, 10000.0f); > > > m_viewer->realize(); > > m_viewer->frame(); > > > assert(wglGetCurrentContext()); // Fails > > > I have tried m_graphicsContext->makeCurrent(); > > wglGetCurrentContext STILL returns null... > > I know that I'm missing something, question is what? > > > /Anders > > -- > __________________________________________ > Anders Backman, HPC2N > 90187 Umeå University, Sweden > and...@cs.umu.se http://www.hpc2n.umu.se > Cell: +46-70-392 64 67 > -- __________________________________________ Anders Backman, HPC2N 90187 Umeå University, Sweden and...@cs.umu.se http://www.hpc2n.umu.se Cell: +46-70-392 64 67
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org