linux下OpenCasCade初始化

本文介绍如何在Linux系统中进行OpenCasCade的初始化步骤,包括必要的头文件引用和初始化代码示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

头文件需要自己引用一下

初始化代码如下

    Handle(Aspect_DisplayConnection) aDisplayConnection =
                new Aspect_DisplayConnection();

        // Get graphic driver if it exists, otherwise initialise it
        if (myGraphicDriver.IsNull())
        {
            myGraphicDriver = new OpenGl_GraphicDriver(aDisplayConnection);
        }

        // Get window handle. This returns something suitable for all platforms.
        WId window_handle = (WId) winId();

    // Create appropriate window for platform
#ifdef WNT
    Handle(WNT_Window) wind = new WNT_Window((Aspect_Handle) window_handle);
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
    Handle(Cocoa_Window) wind = new Cocoa_Window((NSView *) window_handle);
#else
    Handle(Xw_Window) wind = new Xw_Window(aDisplayConnection, (Window) window_handle);
#endif

// Create V3dViewer and V3d_View
myViewer = new V3d_Viewer(myGraphicDriver, Standard_ExtString("viewer3d"));

myView = myViewer->CreateView();

myView->SetWindow(wind);
if (!wind->IsMapped()) wind->Map();

// Create AISInteractiveContext
myAISContext = new AIS_InteractiveContext(myViewer);

// Set up lights etc
myViewer->SetDefaultLights();
myViewer->SetLightOn();

myView->SetBackgroundColor(Quantity_NOC_BLACK);
myView->MustBeResized();
myView->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_GOLD, 0.08, V3d_ZBUFFER);

myAISContext->SetDisplayMode(AIS_Shaded, Standard_True);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值