Posted on 2014-07-16 22:49
eryar 閱讀(5569)
評(píng)論(0) 編輯 收藏 引用 所屬分類:
2.OpenCASCADE
OpenCascade 6.7.1 and Qt 5
eryar@163.com
Keywords: OpenCascade 6.7.1, Qt5, Demo
從OpenCascade6.7.0開始圖形顯示的初始化部分有較大改動(dòng),將原來(lái)給出的一個(gè)關(guān)于Qt的最簡(jiǎn)單的例子程序升級(jí)到最新版本:
Qt with OpenCascade: http://www.shnenglu.com/eryar/archive/2013/08/18/202617.html
Qt的版本還是原來(lái)的,OpenCascade使用最新版本OpenCascade6.7.1:

Figure 1. OpenCascade Version info
主要是更改顯示部分初始化部分的代碼,如下所示,
void occQt::InitializeModeler( void )
{
Handle_Aspect_DisplayConnection displayConnection;
Handle_Graphic3d_GraphicDriver graphicDriver;
// 1. Create a 3D viewer.
try
{
//myGraphicDevice = new Graphic3d_WNTGraphicDevice;
graphicDriver = Graphic3d::InitGraphicDriver(displayConnection);
}
catch (Standard_Failure)
{
QMessageBox::critical(this, tr("About occQt"),
tr("<h2>Fatal error in graphic initialisation!</h2>"),
QMessageBox::Apply);
}
myViewer = new V3d_Viewer(graphicDriver, Standard_ExtString("Visu3D"));
//myViewer->Init();
myViewer->SetDefaultLights();
myViewer->SetLightOn();
// 3. Create an interactive context.
myContext = new AIS_InteractiveContext(myViewer);
myContext->SetDisplayMode(AIS_Shaded);
}
增加了個(gè)變換的示例,程序運(yùn)行效果如下圖所示:

Figure 2. Transformation in occQt