After experimenting a little with vtkCaptionActor2D directly, I now switched to vtkCaptionWidget and like it a little better, with its automated arrow glyph and positionable text.
One thing I can’t figure out though is how to make the caption text not scale (or at least not so much) with the size of the window it is placed in (context: I use a 3D scene in a Qt widget, which is embedded in a larger layout and can be resized arbitrarily to better adapt to the user’s task at hand,.
With the vtkCaptionActor2D
alone, I could achieve this by setting the TextScaleMode
to None
:
vtkNew<vtkCaptionActor2D> actor2D;
actor2D->GetTextActor()->SetTextScaleModeToNone();
Trying the same on the vtkCaptionWidget
seems to have no effect however:
vtkNew<vtkCaptionRepresentation> captionRep;
// captionRep setup...
captionRep->GetCaptionActor2D()->SetTextScaleModeToNone();
vtkNew<vtkCaptionWidget> caption3D;
// caption3D setup...
caption3D->SetRepresentation(captionRep);
The only way I found so far to affect the font size (but only relative to the automatic scaling) is via vtkCaptionRepresentation
’s font factor:
captionRep->SetFontFactor(0.6);
There is probably some easy way to disable the automatic scaling in vtkCaptionWidget
that I am overlooking?