<div dir="ltr"><div><div><div><div>Hi,<br><br></div>I did follow this post to add these 2 macros, <a href="http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Factories_now_require_defines">http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Factories_now_require_defines</a><br>
<br></div>But still not resolved this problem. The following is a sample code using cone example on wiki. <br>---------------------------------------------<br><br>#include "stdafx.h"<br><br>#include "vtkConeSource.h"<br>
#include "vtkPolyData.h"<br>#include "vtkSmartPointer.h"<br>#include "vtkPolyDataMapper.h"<br>#include "vtkActor.h"<br>#include "vtkRenderWindow.h"<br>#include "vtkRenderer.h"<br>
#include "vtkRenderWindowInteractor.h"<br> <br><br>#define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)<br>#define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL)<br>
<br><br><br>int main(int, char *[])<br>{<br> //Create a cone<br> vtkSmartPointer<vtkConeSource> coneSource =<br> vtkSmartPointer<vtkConeSource>::New();<br> coneSource->Update();<br> <br> //Create a renderer, render window, and interactor<br>
vtkSmartPointer<vtkRenderer> renderer =<br> vtkSmartPointer<vtkRenderer>::New();<br><br> if (!renderer)<br> std::cout << "renderer is null " << std::endl;<br><br> vtkSmartPointer<vtkRenderWindow> renderWindow =<br>
vtkSmartPointer<vtkRenderWindow>::New();<br> renderWindow->AddRenderer(renderer);<br> vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =<br> vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
renderWindowInteractor->SetRenderWindow(renderWindow);<br><br> //Create a mapper and actor<br> vtkSmartPointer<vtkPolyDataMapper> mapper =<br> vtkSmartPointer<vtkPolyDataMapper>::New();<br> mapper->SetInputConnection(coneSource->GetOutputPort());<br>
<br> vtkSmartPointer<vtkActor> actor =<br> vtkSmartPointer<vtkActor>::New();<br> actor->SetMapper(mapper);<br> <br> <br> //Add the actors to the scene<br> renderer->AddActor(actor);<br> renderer->SetBackground(.3, .2, .1); // Background color dark red<br>
<br> //Render and interact<br> renderWindow->Render();<br> renderWindowInteractor->Start();<br> <br> return EXIT_SUCCESS;<br>}<br>---------------------------------------------------------------------<br><br></div>
Any comment or answer is very appreciated.<br><br></div>Chao<br></div>