[vtkusers] vtk codeblocks load image

Regina reginaccoelho at gmail.com
Fri Sep 24 16:01:35 EDT 2010


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;
}






More information about the vtkusers mailing list