[vtkusers] vtkImageMapper error
John Biddiscombe
jbiddiscombe at skippingmouse.co.uk
Fri Apr 4 05:50:41 EST 2003
No. Don't use RenderToRectangleOn unless you are requesting a specific
region of the screen
// Description:
// If RenderToRectangle is set (by default not), then the imagemapper
// will render the image into the rectangle supplied by the Actor2D's
// PositionCoordinate and Position2Coordinate
if you haven't explicitly set position and position2 then don't use it.
JB
----- Original Message -----
From: "Neil Killeen" <Neil.Killeen at atnf.csiro.au>
To: <vtkusers at public.kitware.com>
Sent: Wednesday, April 02, 2003 4:39 AM
Subject: [vtkusers] vtkImageMapper error
> Hello
>
> some time ago, our student posted a message
>
> http://public.kitware.com/pipermail/vtkusers/2003-February/016105.html
>
> requesting help with vtkImageMapper.
>
> He received no reply, and the problem still exists in VTK 4.2
>
> The enclosed test program, stretch.cxx, will generate a Bus Error under
> Solaris. Under Linux, where he was working, the behaviour was
> un-useful (see message above).
>
> Run the program with the provided jpg image as input.
>
> ./stretch tycho.jpg
>
>
> The basic function causing the trouble is
>
> vtkImageMapper::RenderToRectangleOn();
>
> when this function call is commented out, the program runs successfully.
> We assume his usage of the funciton is correct but would be delighted
> to learn otherwise !
>
>
> Would somebody respond please ?
>
> thanks
> Neil Killeen
>
>
>
>
> // stretch.cxx
>
> #include <vtkActor.h>
> #include <vtkRenderWindow.h>
> #include <vtkRenderer.h>
> #include <vtkRenderWindowInteractor.h>
> #include <vtkJPEGReader.h>
> #include <vtkImageMapper.h>
> #include <vtkImageData.h>
> #include <vtkActor2D.h>
>
> #include <iostream>
> #include <math.h>
> using namespace std;
>
> #define WINWIDTH 300
> #define WINHEIGHT 300
>
> int main(int argc, char **argv)
> {
> int dims[3];
>
> vtkJPEGReader *jpeg = vtkJPEGReader::New();{
> jpeg->SetFileName(argv[1]);
> jpeg->Update();
> jpeg->GetOutput()->GetDimensions(dims);
> }
> vtkImageMapper *mapper = vtkImageMapper::New();{
> mapper->SetInput(jpeg->GetOutput());
> mapper->RenderToRectangleOn(); // Trouble maker
> }
>
> vtkActor2D *actor = vtkActor2D::New();{
> actor->SetMapper(mapper);
> actor->GetPosition2Coordinate()->SetCoordinateSystemToViewport();
> actor->SetPosition(0,0);
> actor->SetPosition2(dims[0],dims[1]);
> }
>
> vtkRenderer *ren = vtkRenderer::New();{
> ren->AddActor(actor);
> }
>
> vtkRenderWindow *win = vtkRenderWindow::New();{
> win->AddRenderer(ren);
> win->SetSize(dims[0],dims[1]);
> }
>
> vtkRenderWindowInteractor *rwi = vtkRenderWindowInteractor::New();{
> rwi->SetRenderWindow(win);
> rwi->Start();
> }
>
> return 0;
> }
>
>
>
>
More information about the vtkusers
mailing list