当前位置:网站首页>Texture mapping for VTK learning
Texture mapping for VTK learning
2022-06-10 08:46:00 【Christo3】
1. practice
#include <vtkSmartPointer.h>
#include <vtkJPEGReader.h>
#include <vtkTexture.h>
#include <vtkPlaneSource.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);
VTK_MODULE_INIT(vtkRenderingFreeType);
// The test file :data/texture.jpg
int main(int argc, char* argv[])
{
//if (argc < 2)
//{
// std::cout<<argv[0]<<" "<<"TextureFile(*.jpg)"<<std::endl;
// return EXIT_FAILURE;
//}
const char* str = "D:\\workshop\\VTK\\VTK\\vtk_source\\Examples\\Examples\\Chap02\\data\\texture.jpg";
vtkSmartPointer< vtkJPEGReader > reader =
vtkSmartPointer< vtkJPEGReader >::New();
reader->SetFileName(str);
vtkSmartPointer< vtkTexture > texture =
vtkSmartPointer< vtkTexture >::New();
texture->SetInputConnection( reader->GetOutputPort() );
texture->InterpolateOn();
vtkSmartPointer< vtkPlaneSource > plane =
vtkSmartPointer< vtkPlaneSource >::New();
vtkSmartPointer< vtkPolyDataMapper > mapper =
vtkSmartPointer< vtkPolyDataMapper >::New();
mapper->SetInputConnection( plane->GetOutputPort() );
vtkSmartPointer< vtkActor > actor =
vtkSmartPointer< vtkActor >::New();
actor->SetMapper( mapper );
actor->SetTexture( texture );
vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
renderer->AddActor( actor );
renderer->SetBackground( 1.0, 1.0, 1.0);
vtkSmartPointer<vtkRenderWindow> renWin =
vtkSmartPointer<vtkRenderWindow>::New();
renWin->AddRenderer( renderer );
renWin->SetSize( 640, 480 );
renWin->Render();
renWin->SetWindowName("TextureExample");
vtkSmartPointer<vtkRenderWindowInteractor> iren =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
iren->SetRenderWindow(renWin);
iren->Initialize();
iren->Start();
return EXIT_SUCCESS;
}


notes : There is no requirement for the size of the input picture
边栏推荐
- The R language uses the CS function of epidisplay package to calculate the value and confidence interval of relative risk (RR), generate the grouping data of exposure factor based on the pyramid funct
- MMSegmention系列之六(训练技巧)
- JS obtain the date of birth, gender and age through ID number
- Sqlserver restore failed (the database is in use and cannot gain exclusive access to the database)
- Simple operation and debugging of GPIO in Qualcomm platform
- Video | Le Xin R & D theory
- The tab1 function in the epidisplay package of R language calculates the frequency of vector data and visualizes it (one-dimensional frequency table, frequency percentage, cumulative percentage, using
- R语言epiDisplay包的tab1函数计算向量数据的频率并可视化(一维频率表、频数的百分比、累积的百分比、使用条形图可视化频数分布)、使用cex.lab参数自定义频数条形条形图轴标签文本字体的大小
- SqlServer还原失败(数据库正在使用,无法获得对数据库的独占访问权)
- R语言使用neuralnet包构建神经网络回归模型(前馈神经网络回归模型),plot函数可视化训练完成的神经网络模型(包含输入输出、模型结构、权重等信息)
猜你喜欢

Restore of sqlserver different database names

How far is your team from continuous deployment in 2022?

伦敦旅游必去博物馆推荐:伦敦自然历史博物馆

如何在使用 Flutter时切换应用时隐藏应用预览

Ayutthaya, Bangkok, Thailand, was rated as "the most worthwhile city to visit in the post epidemic era" by Forbes

Test preparation computer database day 3 MySQL

Test preparation database computer level 2 day 6

If you want to change careers, why do you prefer software testing?

樂鑫推出 ESP32-C3 的 AWS IoT 參考示例

软件测试|从HR那里冒险套路过来的面试经验,绝对加分项
随机推荐
Mmsegment Series III (basic network architecture and pre training model)
Numpy version problem
USB type -a -b -c interface
Huawei software test interview question | a Huawei successful employee's sharing [written examination question]
AWS IOT reference example of Lexin launching esp32-c3
Idea JDBC error
Task04:集合运算
One paper second kill all permutation and combination subsets problem
Test preparation computer database day 3 MySQL
wechat_微信小程序分包的配置
Software testing | interview experience from HR's risky routine, absolutely plus points
What is L3? Why do we need L3? How to build?
How much do you need to learn before you can find a job in the software test of zero foundation career transition
The tab1 function in the epidisplay package of R language calculates the frequency of vector data and visualizes it (one-dimensional frequency table, frequency percentage, cumulative percentage, using
解压jar包修改配置文件(解压、修改、压缩、运行)
R语言caTools包进行数据划分、scale函数进行数据缩放、class包的knn函数构建K近邻分类器、比较不同K值超参数下模型准确率和误分类率(miss classification error)
uni-app_开发微信小程序项目中配置网络请求(第三方包 @escook/request-miniprogram)
Sslerror: ('the read operation timed out'), solution
SqlServer不同数据库名的还原
Mmsegment Series III (basic network architecture and pre training model)