tpaviot / oce

OpenCASCADE Community Edition (OCE): a community driven fork of the Open CASCADE library.
http://groups.google.com/group/oce-dev
GNU Lesser General Public License v2.1
811 stars 284 forks source link

CSharp sample is error. #717

Open toolgood opened 5 years ago

toolgood commented 5 years ago

Position:OCCTProxy->InitViewer

bool InitViewer(System::IntPtr theWnd)
    {
        try
        {
            Handle(Aspect_DisplayConnection) aDisplayConnection;
            myGraphicDriver() = new OpenGl_GraphicDriver(aDisplayConnection);
        }
        catch (Standard_Failure)
        {
            return false;
        }

        TCollection_ExtendedString a3DName("Visu3D");
        myViewer() = new V3d_Viewer(myGraphicDriver(), a3DName.ToExtString(), "", 1000.0,
            V3d_XposYnegZpos, Quantity_NOC_GRAY30,
            V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
            Standard_True, Standard_False);

        myViewer()->SetDefaultLights();
        myViewer()->SetLightOn();
        myView() = myViewer()->CreateView();
        Handle(WNT_Window) aWNTWindow = new WNT_Window(reinterpret_cast<HWND> (theWnd.ToPointer()));
        myView()->SetWindow(aWNTWindow); //is error, show "System.Runtime.InteropServices.SEHException:“外部组件发生异常。”"

window 10 vs 2017