[vtkusers] vtk codeblocks load image
David Doria
daviddoria at gmail.com
Fri Sep 24 16:16:41 EDT 2010
On Fri, Sep 24, 2010 at 4:01 PM, Regina <reginaccoelho at gmail.com> wrote:
> Hi,
> I am trying to load a image (jpg or bmp) using vtk with Codeblocks (MinGW),
> but
> I can´t see the image. To appear the message:
> " ERROR: In
> /export/Win32/Kuzco/src/Depends/Toolkits/VTK/IO/vtkJPEGReader.cxx,
> line 81
> vtkJPEGReader (0x57d678): Unable to open file stormy.jpg"
>
>
> Somebody can help me, please?
>
> The code is:
>
> int main ()
> {
>
> vtkJPEGReader *imageIn = vtkJPEGReader::New();
> imageIn->SetFileName("stormy.jpg");
> vtkRenderer *renderer = vtkRenderer::New();
> vtkRenderWindow *renderWindow = vtkRenderWindow::New();
> renderWindow->AddRenderer(renderer);
> vtkImageActor *imageActor = vtkImageActor::New();
> imageActor->SetInput(imageIn->GetOutput());
> renderer->AddActor(imageActor);
> vtkRenderWindowInteractor *interactor = vtkRenderWindowInteractor::New();
> interactor->SetRenderWindow(renderWindow);
> renderer->SetBackground(0.2, 0.3, 0.4);
> renderWindow->SetSize(320, 256);
> interactor->Initialize();
> renderWindow->Render();
> interactor->Start();
>
> return 0;
> }
>
>
>
My guess is that your "working directory" is not set correctly (i.e. to the
directory that the file is in).
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100924/33604402/attachment.htm>
More information about the vtkusers
mailing list