欢迎来到天天文库
浏览记录
ID:39469754
大小:1.48 MB
页数:44页
时间:2019-07-04
《VTK入门程序样例分析-vtk与MFc混编》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、VTk与MFC混编前面几个例子是熟悉vtk的,练习时用控制台程序编写,vtk与MFC混编的过程中遇到了很多问题,为了方便大家,我把这一过程中的遇到的错误和解决办法都记录下来了,希望能够对大家有所帮助VTK入门程序样例分析一、圆锥圆柱类1、简单圆锥【圆锥鼠标拖动】#include"vtkConeSource.h"#include"vtkPolyDataMapper.h"#include"vtkRenderWindow.h"#include"vtkCamera.h"#include"vtkActor.h"#include"vtkRenderer.h"intmain(){vtkConeSou
2、rce*cone=vtkConeSource::New();cone->SetHeight(3.0);cone->SetRadius(1.0);cone->SetResolution(10);vtkPolyDataMapper*coneMapper=vtkPolyDataMapper::New();coneMapper->SetInputConnection(cone->GetOutputPort());vtkActor*coneActor=vtkActor::New();coneActor->SetMapper(coneMapper);vtkRenderer*ren1=vtkRend
3、erer::New();ren1->AddActor(coneActor);ren1->SetBackground(0.1,0.2,0.4);vtkRenderWindow*renWin=vtkRenderWindow::New();renWin->AddRenderer(ren1);renWin->SetSize(300,300);inti;for(i=0;i<360;++i){//rendertheimagerenWin->Render();//rotatetheactivecamerabyonedegreeren1->GetActiveCamera()->Azimuth(1);}
4、cone->Delete();coneMapper->Delete();coneActor->Delete();ren1->Delete();renWin->Delete();return0;}1、新建工程2、输入代码3、添加包含文件1、编译出错cone1.obj:errorLNK2019:unresolvedexternalsymbol"__declspec(dllimport)public:void__thiscallvtkCamera::Azimuth(double)"(__imp_?Azimuth@vtkCamera@@QAEXN@Z)referencedinfunction_
5、wmain错误解决办法errorLNK2019:无法解析的外部符号"__declspec(dllimport)public:staticclass...称找不到vtkIO.dll对应解决办法:在每个项目属性的链接器->输入->附加依赖项中添加入vtkIO.lib库,目录为:........binDebugvtkIO.libF:VTK58binbinDebugvtkMFC.lib;F:VTK58binbinDebugvtkRendering.lib;F:VTK58binbinDebugvtkIO.lib;F:VTK58binbinDebu
6、gvtkFiltering.lib;F:VTK58binbinDebugvtkCommon.lib;DelayImp.lib;F:VTK58binbinDebugvtkGraphics.lib;F:VTK58binbinDebugvtkImaging.lib;F:VTK58binbinDebugvtkFiltering.lib;F:VTK58binbinDebugvtkCommon.lib;F:VTK58binbinDebugvtksys.lib;错误没了!2、Callback命令#include"vtkConeSource
7、.h"#include"vtkPolyDataMapper.h"#include"vtkRenderWindow.h"#include"vtkCommand.h"#include"vtkCamera.h"#include"vtkActor.h"#include"vtkRenderer.h"//CallbackfortheinteractionclassvtkMyCallback:publicvtkCommand{public:staticvtk
此文档下载收益归作者所有