Simply put, VTK is an object-oriented
approach to 3D graphics and Visualization.
|
This image used to rotate, but is now static to conserve space |
#include "vtk.hh" main() { int i; // These are incredibly typical things- // we'll use them virtually everytime we write programs. vtkRenderMaster rm; vtkRenderWindow *rw; vtkRenderer *ren; // These declarations will vary depending // on what we are trying to do. vtkTextSource *string; vtkPolyMapper *polyMapper; vtkActor *actor; // First we make our window. rw = rm.MakeRenderWindow(); ren = rw->MakeRenderer(); // Next we create a bunch of polygons to // represent our question mark. string = new vtkTextSource; string->SetText("?"); // Now, we send those polygons out to be mapped. polyMapper = new vtkPolyMapper; polyMapper->SetInput(string->GetOutput()); // The only actor in our scene will be comprised // of this group of polygons. actor = new vtkActor; actor->SetMapper(polyMapper); // Add the actor and render the scene! ren->AddActors(actor); rw->Render(); // Animating isn't all that tough, either. for(i=0;i<12;i++) { ren->GetActiveCamera()->Azimuth(30); rw->Render(); } }