[vtkusers] vtkPolyDataMapper error

T.R.Shashwath trshash84 at gmail.com
Sat Mar 1 23:49:05 EST 2008


On Sunday 02 Mar 2008 1:55:35 am hiba chelbi wrote:
> Good evening.
> I wrote a main file which should show a bitmap image.
>
> int main(int argc, char **argv)
> {
>     // a renderer and and render window
>     vtkRenderer *renderer = vtkRenderer ::New() ;
>     vtkRenderWindow *renderWindow = vtkRenderWindow ::New() ;
>     renderWindow->AddRenderer(renderer) ;
>
>     // an interactor
>     vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor ::New() ;
>     iren->SetRenderWindow(renderWindow) ;
>
>     // render an image (lights and cameras are created automatically)
>     renderWindow->Render() ;
>
>     // charger une image bmp
>     vtkImageReader *reader = vtkImageReader ::New();
>     reader->SetFileName("C:\Documents and Settings\Hibatollah Chelbi\Mes
> documents\2.Mes images\Temple.bmp");
>
>     vtkTexture *texture = vtkTexture ::New();
>     texture->SetInput(reader->GetOutput());
>
>     // map to graphics library
>     vtkPolyDataMapper *map = vtkPolyDataMapper :: New();
>     map->SetInput(reader->GetOutput()) ;
>
>     // actor coordinates geometry, properties, transformation
>     vtkActor *aReader = vtkActor ::New() ;
>     aReader->SetMapper(map) ;
>
>     // add the actor to the scene
>     renderer->AddActor(aReader) ;
>
>     // render an image (lights and cameras are created automatically)
>     renderWindow->Render() ;
>
>     //begin mouse action
>     iren->Start() ;
>
>     return 0 ;
> }
>
> When i compile it, i have this message:
> "'SetInput' : cannot convert parameter 1 from 'class vtkImageData *' to
> 'class vtkPolyData *'
>
> Is it false what i wrote?? and how can i correct the error?

If all you want to do is view an image, why don't you use vtkImageActor 
instead?

Regards,
Shash



More information about the vtkusers mailing list