<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      VTK-8.2.0源碼編譯和初步使用(Cmake+VS2015+Qt5.14.2)

      一、準(zhǔn)備數(shù)據(jù)

      1、首先確保已安裝VS5015和Qt5.14.2

      2、下載Cmake并安裝:Download CMake

      3、下載VTK-8.2.0源碼和數(shù)據(jù)并解壓:Download | VTK

      二、Cmake構(gòu)建

      1、在本地磁盤創(chuàng)建相關(guān)文件夾

      2、進入源碼根目錄,找到CmakeList.txt,修改CmakeList.txt中的選項,使得Debug模式下生成的lib和dll文件能自帶后綴_d,便于和Release的庫文件進行區(qū)分,否則后面可能編譯或鏈接有問題。

      3、在Cmake中填入源碼位置,編譯后的位置,勾選Grouped方便看分組,點擊Configure,選擇VS2015,x64,點擊Finish,等待配置完成。

      4、按下圖勾選,并設(shè)置庫文件統(tǒng)一存放目錄,再次點擊Configure。(如果勾選BUILD_TESTING后期VS編譯時間會比較長,默認(rèn)不勾選)

       5、確認(rèn)Qt的相關(guān)目錄是否正確,不正確手動修改為正確的Qt的目錄,VTK_QT_VERSION根據(jù)自己的Qt版本選擇5或6,再次Configure,直至確認(rèn)所有紅色選項消失,點擊Generate

      6、進入VTK-8.2.0-Build目錄,找到VTK.sln,用VS2015打開,先選擇Debug, x64平臺,解決方案管理器中,找到INSTALL項目,右鍵,生成,等待VS編譯完成。再選擇Release,x64平臺,再次生成INSTALL項目。

       7、VS編譯完成后,在VTK-8.2.0-Install文件夾中就會有我們想要的頭文件、庫文件(Debug和Release庫都在里面),隨后將bin文件夾加入系統(tǒng)環(huán)境變量,方便后續(xù)VS或Qt中使用

       三、在QCreator中創(chuàng)建工程VTKTest,以官方代碼Hello VTK為例,

      1、打開pro文件,添加VTK庫文件

       

      INCLUDEPATH += E:\Code\VTK-8.2.0-Install\include\vtk-8.2
      
      win32:CONFIG(debug, debug|release): LIBS += -LE:\Code\VTK-8.2.0-Install\lib \
                              -lvtkFiltersSources-8.2_d \
                              -lvtkCommonColor-8.2_d \
                              -lvtkCommonCore-8.2_d \
                              -lvtkCommonExecutionModel-8.2_d \
                              -lvtkFiltersSources-8.2_d \
                              -lvtkInteractionStyle-8.2_d \
                              -lvtkRenderingContextOpenGL2-8.2_d \
                              -lvtkRenderingCore-8.2_d \
                              -lvtkRenderingFreeType-8.2_d \
                              -lvtkRenderingGL2PSOpenGL2-8.2_d \
                              -lvtkRenderingOpenGL2-8.2_d \
                              -lvtkGUISupportQt-8.2_d
      else:win32:CONFIG(release, debug|release): LIBS +=-LE:\Code\VTK-8.2.0-Install\lib \
                              -lvtkFiltersSources-8.2 \
                              -lvtkCommonColor-8.2 \
                              -lvtkCommonCore-8.2 \
                              -lvtkCommonExecutionModel-8.2 \
                              -lvtkFiltersSources-8.2 \
                              -lvtkInteractionStyle-8.2 \
                              -lvtkRenderingContextOpenGL2-8.2 \
                              -lvtkRenderingCore-8.2 \
                              -lvtkRenderingFreeType-8.2 \
                              -lvtkRenderingGL2PSOpenGL2-8.2 \
                              -lvtkRenderingOpenGL2-8.2 \
                              -lvtkGUISupportQt-8.2

      2、在main.cpp中添加初始化代碼

       

      #include<vtkAutoInit.h>
      VTK_MODULE_INIT(vtkRenderingOpenGL2)
      VTK_MODULE_INIT(vtkInteractionStyle)
      VTK_MODULE_INIT(vtkRenderingFreeType)

      3、MainWindow.h

      #ifndef MAINWINDOW_H
      #define MAINWINDOW_H
      
      #include <QMainWindow>
      #include <QVTKOpenGLWidget.h>
      
      QT_BEGIN_NAMESPACE
      namespace Ui
      {
          class MainWindow;
      }
      QT_END_NAMESPACE
      
      class MainWindow : public QMainWindow
      {
          Q_OBJECT
      
      public:
          MainWindow(QWidget *parent = nullptr);
          ~MainWindow();
      
      private:
          Ui::MainWindow *ui;
          QVTKOpenGLWidget *m_pScene;
      };
      #endif // MAINWINDOW_H

      4、MainWindow.cpp

      #include "MainWindow.h"
      #include "ui_MainWindow.h"
      
      #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 <vtkGenericOpenGLRenderWindow.h>
      #include <array>
      
      MainWindow::MainWindow(QWidget *parent)
          : QMainWindow(parent)
          , ui(new Ui::MainWindow)
          , m_pScene(nullptr)
      {
          ui->setupUi(this);
      
          m_pScene = new QVTKOpenGLWidget();
          this->setCentralWidget(m_pScene);
      
          vtkNew<vtkNamedColors> colors;
      
          // Set the background color.
          std::array<unsigned 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).
          vtkNew<vtkCylinderSource> 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.
          vtkNew<vtkPolyDataMapper> 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.
          vtkNew<vtkActor> 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 added
          vtkNew<vtkRenderer> 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);
      
          vtkSmartPointer<vtkGenericOpenGLRenderWindow> window = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
          window->AddRenderer(renderer);
      
      
          m_pScene->SetRenderWindow(window);
          m_pScene->GetRenderWindow()->Render();
          m_pScene->GetRenderWindow()->Start();
      }
      
      MainWindow::~MainWindow()
      {
          delete ui;
      }

      5、結(jié)果。

      總結(jié):

      最好事先在Debug模式下加入后綴_d,否則容易混淆庫文件,按上述步驟,在Debug模式和Release模式下都可以運行!

       

      posted @ 2025-03-20 21:43  圐圙  閱讀(769)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 国产AV国片精品有毛| 亚洲免费观看视频| 久久精品人人槡人妻人人玩av| 国产av亚洲一区二区| 人妻系列无码专区无码中出| 日本精品一区二区不卡| 蜜桃一区二区三区免费看| 8av国产精品爽爽ⅴa在线观看| 69天堂人成无码免费视频 | 国产精品不卡一二三区| 国产精品久久久久9999高清| 国产综合亚洲区在线观看| 艳妇乳肉豪妇荡乳在线观看| 性按摩玩人妻hd中文字幕| 日韩精品视频一二三四区| 日韩有码精品中文字幕| 鲜嫩高中生无套进入| 久久精品日韩av无码| 成人拍拍拍无遮挡免费视频| 荣成市| 大陆一级毛片免费播放| 午夜A理论片在线播放| 国产中文字幕精品免费| 久久中文字幕无码一区二区| 亚洲AV旡码高清在线观看| 亚洲一区二区精品偷拍| 999精品色在线播放| 久久精品国产91精品亚洲| 亚洲高清WWW色好看美女| 国内揄拍国内精品少妇国语| 亚洲欧美激情另类| 亚洲精品天堂一区二区| 精品久久综合日本久久网| 婷婷六月天在线| 黄色亚洲一区二区在线观看| 国产精品99中文字幕| 惠安县| 亚洲春色在线视频| 老司机精品成人无码AV| 精品乱码一区二区三四五区| 日韩一区二区三区女优丝袜|