Hi, I am working to make a osg scene editor with MFC. I just followed the 
example of osgViewerMFC and create a GraphicsContext for every MFC document. 

For the 1st document everything runs smoothly, but when I tried to create 
another GraphicsContext, the program throws a exception. 

So, how can I create a GraphicsContext again correctly?

This is how I create a GraphicsContext in MFC, just the same as the sample in 
the OSG SDK.

Code:

    osg::ref_ptr<osg::Referenced> windata = new 
osgViewer::GraphicsWindowWin32::WindowData(m_hWnd);

    // Setup the traits parameters
    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->setInheritedWindowPixelFormat = true;
    traits->inheritedWindowData = windata;

    //<========== stuck here
    mGC = osg::GraphicsContext::createGraphicsContext(traits.get());




Thank you.

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





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to