Hi<br>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<br><br>Fist one:<br><br><span style="font-family: courier new,monospace;"> private vtkFollower createTextOld(String itext, vtkCamera camera, float[] ds, Color color) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> double dist = ray * .75;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> final double textScale = 1 / 13.0;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> vtkVectorText text = new vtkVectorText();</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> text.SetText(itext);</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> vtkPolyDataMapper mapper = new vtkPolyDataMapper();</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> mapper.SetInputConnection(text.GetOutputPort());</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> vtkFollower textActor = new vtkFollower();</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> textActor.SetCamera(camera);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> textActor.GetProperty().SetLighting(false);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> textActor.GetProperty().SetColor(color.getRed() / 256d, color.getGreen() / 256d, color.getBlue() / 256d);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> textActor.SetMapper(mapper);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> textActor.SetPosition(ds[0] + dist, ds[1] + dist, ds[2] + dist);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> textActor.SetScale(textScale);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> return textActor;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> }</span><br>Second one:<br><span style="font-family: courier new,monospace;"> private vtkActor createText2(String itext, vtkCamera camera, float[] ds, Color color) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">
double dist = ray * .75;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
final double textScale = 1 / 13.0;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
vtkVectorText text = new vtkVectorText();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
text.SetText(itext);</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
vtkTransformFilter filter = new vtkTransformFilter();</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
vtkTransform transform = new vtkTransform();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
transform.Translate(ds[0] + dist, ds[1] + dist, ds[2] + dist);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
transform.Scale(textScale, textScale, textScale);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
filter.SetTransform(transform);</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
filter.SetInput(text.GetOutput());</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
filter.Update();</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
vtkPolyDataMapper mapper = new vtkPolyDataMapper();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
mapper.SetInputConnection(filter.GetOutputPort());</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
vtkFollower textActor = new vtkFollower();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
textActor.SetCamera(camera);</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
// vtkActor textActor = new vtkActor();</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
textActor.GetProperty().SetLighting(false);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
textActor.GetProperty().SetColor(color.getRed() / 256d, color.getGreen() / 256d, color.getBlue() / 256d);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
textActor.SetMapper(mapper);</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
return textActor;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
}</span><br><br>Is that a bug or is it me doing something wrong?<br>I need to get the second working.<br>thanks a lot<br clear="all"><br>-- <br>Enrico Scantamburlo <br><br>"For people that try to compensate the lack of capacity with more effort, there is no limit to the things they cannot do"<br>
<br><br>