Posted on 2014-07-16 22:49
eryar 阅读(5509)
评论(0) 编辑 收藏 引用 所属分类:
2.OpenCASCADE
OpenCascade 6.7.1 and Qt 5
eryar@163.com
Keywords: OpenCascade 6.7.1, Qt5, Demo
从OpenCascade6.7.0开始图形显示的初始化部分有较大改动,将原来给出的一个关于Qt的最简单的例子程序升级到最新版本:
Qt with OpenCascade: http://www.cppblog.com/eryar/archive/2013/08/18/202617.html
Qt的版本还是原来的,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);
}
增加了个变换的示例,程序运行效果如下图所示:
Figure 2. Transformation in occQt
Sample code for OpenCascade6.7.1: Qt with OpenCascade