[vtkusers] background picture

Jifeng Yao crazyyao at mail.rdcps.ac.cn
Mon Mar 7 20:11:57 EST 2005


Here's some code I got from the list before:

********************************************
vtk3DSImporter* importer = vtk3DSImporter::New();
importer->ComputeNormalsOn();
importer->SetFileName("747.3DS");
importer->Read();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin = importer->GetRenderWindow();
renWin->SetNumberOfLayers(2);
vtkRenderer *ren = vtkRenderer::New();
ren->InteractiveOn();
vtkBMPReader *reader = vtkBMPReader::New();
reader->SetFileName("test24BIT.bmp");
reader->Update();
vtkImageData *imageData = reader->GetOutput();
int a[3];
int numCols;
int numRows;
int z;
imageData->GetDimensions(a);
numCols = a[0];
numRows = a[1];
z = a[2];
// scan [[reader GetOutput] GetDimensions] "%d %d %d" numCols numRows z

vtkImageActor *actor = vtkImageActor::New();
actor->SetInput(reader->GetOutput());
ren1->AddActor(actor);
ren1->InteractiveOff();
ren1->GetActiveCamera()->ParallelProjectionOn();
ren1->GetActiveCamera()->SetParallelScale(numRows/2);

renWin->SetSize(numCols,numRows);
renWin->AddRenderer(ren1);
ren1->SetLayer(1);
ren->SetLayer(0);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();

iren->SetRenderWindow(renWin);

iren->Initialize();
iren->Start();
*********************************************

VTK v4.2.4:
-----------
self.renwin.AddRenderer(self.axisRenderer)
self.renwin.SetNumberOfLayers(2)
self.main.ren.SetLayer(1)           # <--
self.axisRenderer.SetLayer(0)       # <--

VTK v4.5.0:
-----------
self.renwin.AddRenderer(self.axisRenderer)
self.renwin.SetNumberOfLayers(2)
self.main.ren.SetLayer(0)           # <--
self.axisRenderer.SetLayer(1)       # <--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050308/f1a4b4f1/attachment.htm>


More information about the vtkusers mailing list