HI Ran? Jiao?  Could you sign with your first name so we know how to
address you correctly.

What you are doing looks correct so I would have expected it to work.
Does the osgviewerMFC work for you?

As for using MFC, if you're doing a new app I really wouldn't
recommend using MFC, there are far better free alternatives out there
such as Qt and it isn't tied to Windows.

Robert.


On Tue, Apr 21, 2009 at 4:09 AM, Ran Jiao <[email protected]> wrote:
> 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
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to