[vtkusers] How to specify vtkPlaneSource parameters so that it equals the image size in pixels ?

Siddharth Vikal siddharthvikal at gmail.com
Wed Dec 21 23:24:14 EST 2011


Hi,

I'm trying to use vtkPlaneSource, and pasting a vtkTexture which gets its
data from vtkImageData. The code below displays the image fine, but it does
not match the image size in pixels. How do I configure vtkPlaneSource so
that I see the image of proper size??

------------------------------------------------------------------------------------------------------------------------------------------------

    vtkPNGReader *pngReader = vtkPNGReader::New();
        pngReader->SetFileName(argv[1]);
        pngReader->Update();
        ima = pngReader->GetOutput();

vtkTexture* VTKtexture = vtkTexture::New();
   VTKtexture->SetInput(ima);
   VTKtexture->InterpolateOn();

vtkPlaneSource* VTKplane = vtkPlaneSource::New();
  VTKplane->SetOrigin( -0.5, -0.5, 0.0);
  VTKplane->SetPoint1(  0.5, -0.5, 0.0);
  VTKplane->SetPoint2( -0.5,  0.5, 0.0);

 vtkPolyDataMapper *VTKplaneMapper = vtkPolyDataMapper::New();
  VTKplaneMapper->SetInputConnection(VTKplane->GetOutputPort());


   vtkActor* VTKplaneActor = vtkActor::New();
   VTKplaneActor->SetTexture(VTKtexture);
   VTKplaneActor->SetMapper(VTKplaneMapper);

   vtkRenderer        *ren = vtkRenderer::New();
   vtkRenderWindow *renwin = vtkRenderWindow::New();
   renwin->AddRenderer(ren);
   renwin->FullScreenOn();

 vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
   iren->SetRenderWindow(renwin);
   ren->AddActor(VTKplaneActor);
   ren->SetBackground(0,0,0.5);
   renwin->Render();

--------------------------------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111222/fd3c5e25/attachment.htm>


More information about the vtkusers mailing list