使用gcc创建第一个VTK例子
来源:互联网 发布:尚宝网络 编辑:程序博客网 时间:2024/06/10 19:30
下载的是VTK6.0源码,用CMake创建工程,CodeBlocks13(cbs)编译。
例子是用cbs创建的,从example中复制的,编译后运行提示有问题。
网上有解决方法,就是增加Init的代码。
完整代码:
#include <iostream>using namespace std;#include "vtkActor.h"#include "vtkCamera.h"#include "vtkConeSource.h"#include "vtkPolyDataMapper.h"#include "vtkRenderWindow.h"#include "vtkRenderer.h"#include <vtkAutoInit.h>int main(){ VTK_MODULE_INIT(vtkRenderingOpenGL); vtkConeSource *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= vtkRenderer::New(); ren1->AddActor(coneActor); ren1->SetBackground(0.1, 0.2, 0.4); vtkRenderWindow *renWin = vtkRenderWindow::New(); renWin->AddRenderer(ren1); renWin->SetSize(300, 300); int i; for (i = 0; i < 360; ++i) { renWin->Render(); ren1->GetActiveCamera()->Azimuth(1); } cone->Delete(); coneMapper->Delete(); coneActor->Delete(); ren1->Delete(); renWin->Delete(); getchar(); return 0;}运行时候显示的是一个旋转的圆锥体。
0 0
- 使用gcc创建第一个VTK例子
- 使用Eclipse创建第一个Struts例子
- 使用Dagger2创建的第一个小例子
- 使用Intellij IEDA创建第一个hibernate例子
- 使用Intellij IEDA创建第一个springmvc例子
- 创建第一个sencha touch例子
- VTK学习-第一个多柱体生成
- 使用uVision 创建第一个工程
- 使用Git --- 创建第一个项目
- 创建第一个 Rails 程序(使用mysql)
- 使用HighCharts创建第一个图表实例
- 使用Myeclipse创建第一个Maven项目
- 使用IDEA创建第一个Servlet工程
- 使用Intellij创建第一个Springboot程序
- 使用Intellij创建第一个Springboot程序
- 使用AndroidStudio创建第一个程序Helloword
- 使用Intellij创建第一个Springboot程序
- 使用MyEclipse创建第一个Hibernate实例
- 京东活动系统亿级流量应对之术
- 你只看到别人表面的光鲜,却看不到他们背后的付出和努力
- 简单使用Cocos2dx-lua 实现单例模式
- pho中的Exception类的内建函数getMessage(),getCode(),getFile(),getLine()....
- ContentResolver 简介
- 使用gcc创建第一个VTK例子
- Android应用打开时现黑屏或者白屏问题解决
- imagestring不支持中文,改用imagettftext
- My favorite 10 web application fuzzing tools in fuzzy order
- android 搞定标题随scrollview滑动变色
- 数据结构——线性表的伪链表存储(顺序存储链式遍历)
- WebView内存泄漏解决方法
- 问题
- HTML中margin、padding和border的区别