更新公司网站内容需要,自己可以开发一个app,天津自动网站建设调试,申请网站怎么申请效果 编译 1、下载VTK8.2.0源码 2、解压源码后#xff0c;进入目录创建build目录#xff0c;同时在build内创建install目录 (下图install目录是在cmake第一次后才手动创建#xff0c;建议在创建build时创建) 3、打开CMake#xff0c;如下图填入…效果 编译 1、下载VTK8.2.0源码 2、解压源码后进入目录创建build目录同时在build内创建install目录 (下图install目录是在cmake第一次后才手动创建建议在创建build时创建) 3、打开CMake如下图填入信息并点击Configure后选择如下Vs2017与x64。选择完成后点击Finish按钮。 4、第一次点击Configure后找到下图两个选项。分别配置创建install路径与勾选Qt。然后点击Configure 5、第二次点击Configure后找到下图配置Qt的路径注意路径然后点击Configure后无误再点击Generate、无误后继续点击Open Project于是Vs会打开该项目。 6、如下图进入vs后首先对ALL_BUILD进行生成生成结束后对INSTALL进行生成。最终无误后生成下图下方的目录。 7、如下图将VTK生成的插件拷贝到Qt路径下然后打开QtDesigner 就可以看到有了VTK控件插件。
附上编译好的库 Vs2017测试代码
#include vtkActor.h
#include vtkCamera.h
#include vtkCylinderSource.h
#include vtkNamedColors.h
#include vtkNew.h
#include vtkPolyDataMapper.h
#include vtkProperty.h
#include vtkRenderWindow.h
#include vtkRenderWindowInteractor.h
#include vtkRenderer.h#include array#include vtkAutoInit.h
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);int main(int, char*[])
{vtkNewvtkNamedColors colors;// Set the background color.std::arrayunsigned char, 4 bkg{ {26, 51, 102, 255} };colors-SetColor(BkgColor, bkg.data());// This creates a polygonal cylinder model with eight circumferential facets// (i.e, in practice an octagonal prism).vtkNewvtkCylinderSource cylinder;cylinder-SetResolution(8);// The mapper is responsible for pushing the geometry into the graphics// library. It may also do color mapping, if scalars or other attributes are// defined.vtkNewvtkPolyDataMapper cylinderMapper;cylinderMapper-SetInputConnection(cylinder-GetOutputPort());// The actor is a grouping mechanism: besides the geometry (mapper), it// also has a property, transformation matrix, and/or texture map.// Here we set its color and rotate it around the X and Y axes.vtkNewvtkActor cylinderActor;cylinderActor-SetMapper(cylinderMapper);cylinderActor-GetProperty()-SetColor(colors-GetColor4d(Tomato).GetData());cylinderActor-RotateX(30.0);cylinderActor-RotateY(-45.0);// The renderer generates the image// which is then displayed on the render window.// It can be thought of as a scene to which the actor is addedvtkNewvtkRenderer renderer;renderer-AddActor(cylinderActor);renderer-SetBackground(colors-GetColor3d(BkgColor).GetData());// Zoom in a little by accessing the camera and invoking its Zoom method.renderer-ResetCamera();renderer-GetActiveCamera()-Zoom(1.5);// The render window is the actual GUI window// that appears on the computer screenvtkNewvtkRenderWindow renderWindow;renderWindow-SetSize(300, 300);renderWindow-AddRenderer(renderer);renderWindow-SetWindowName(Cylinder);// The render window interactor captures mouse events// and will perform appropriate camera or actor manipulation// depending on the nature of the events.vtkNewvtkRenderWindowInteractor renderWindowInteractor;renderWindowInteractor-SetRenderWindow(renderWindow);// This starts the event loop and as a side effect causes an initial render.renderWindow-Render();renderWindowInteractor-Start();return EXIT_SUCCESS;
}测试代码出现的问题 解决: 源程序前面加如下代码
#include vtkAutoInit.h
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);笔者 笔者 - jxd