[vtkusers] Problem with vtkFollower and vtkTransform

Enrico Scantamburlo scantamburlo at streamsim.com
Tue Oct 5 08:01:49 EDT 2010


Hi
I am a newbie and I have written two pieces of code that should do the same
thing.,but in the second one the labels do not move and stay stuck on the
screen

Fist one:

    private vtkFollower createTextOld(String itext, vtkCamera camera,
float[] ds, Color color) {
        double dist = ray * .75;
        final double textScale = 1 / 13.0;


        vtkVectorText text = new vtkVectorText();
        text.SetText(itext);

        vtkPolyDataMapper mapper = new vtkPolyDataMapper();
        mapper.SetInputConnection(text.GetOutputPort());


        vtkFollower textActor = new vtkFollower();

        textActor.SetCamera(camera);
        textActor.GetProperty().SetLighting(false);
        textActor.GetProperty().SetColor(color.getRed() / 256d,
color.getGreen() / 256d, color.getBlue() / 256d);
        textActor.SetMapper(mapper);
        textActor.SetPosition(ds[0] + dist, ds[1] + dist, ds[2] + dist);
        textActor.SetScale(textScale);
        return textActor;
    }
Second one:
    private vtkActor createText2(String itext, vtkCamera camera, float[] ds,
Color color) {
         double dist = ray * .75;
        final double textScale = 1 / 13.0;

        vtkVectorText text = new vtkVectorText();
        text.SetText(itext);

        vtkTransformFilter filter = new vtkTransformFilter();

        vtkTransform transform = new vtkTransform();
        transform.Translate(ds[0] + dist, ds[1] + dist, ds[2] + dist);
        transform.Scale(textScale, textScale, textScale);
        filter.SetTransform(transform);

        filter.SetInput(text.GetOutput());

        filter.Update();

        vtkPolyDataMapper mapper = new  vtkPolyDataMapper();
        mapper.SetInputConnection(filter.GetOutputPort());


        vtkFollower textActor = new vtkFollower();
        textActor.SetCamera(camera);

//        vtkActor textActor = new vtkActor();

        textActor.GetProperty().SetLighting(false);
        textActor.GetProperty().SetColor(color.getRed() / 256d,
color.getGreen() / 256d, color.getBlue() / 256d);
        textActor.SetMapper(mapper);

        return textActor;
    }

Is that a bug or is it me doing something wrong?
I need to get the second working.
thanks a lot

-- 
Enrico Scantamburlo

"For people that try to compensate the lack of capacity with more effort,
there is no limit to the things they cannot do"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101005/eff5d976/attachment.htm>


More information about the vtkusers mailing list