[vtkusers] White rectangle instead of text

Torquil Macdonald Sørensen torquil at gmail.com
Fri Nov 8 12:42:07 EST 2013


Hi!

I seem to have problems using vtkTextActor, when using the latest VTK from
Git. Instead of text, I am getting a white rectangle where the text should
be. This happens with the small test program that I'm including in this
email, but also with the example program here:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/DisplayText

In the latter case, I'm seeing no text because the background is also
white, but if I change the background to black, I can see a white rectangle
instead of text.

Here is my test program:

#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkSmartPointer.h"
#include "vtkTextActor.h"

int main()
{
    vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::New();

    vtkSmartPointer<vtkRenderWindow> ren_win =
vtkSmartPointer<vtkRenderWindow>::New();
    ren_win->AddRenderer(ren);

    vtkSmartPointer<vtkRenderWindowInteractor> ren_win_int =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
    ren_win_int->SetRenderWindow(ren_win);

    vtkSmartPointer<vtkTextActor> textActor =
vtkSmartPointer<vtkTextActor>::New();
    textActor->SetInput("Text");

    textActor->Print(cout);

    ren->AddActor(textActor);

    ren_win_int->Initialize();
    ren_win_int->Start();

    return 0;
}

If it helps,I have included a Print() command, and the resulting output is:

vtkTextActor (0x254d420)
  Debug: Off
  Modified Time: 1204
  Reference Count: 1
  Registered Events: (none)
  Dragable: On
  Pickable: On
  AllocatedRenderTime: 10
  EstimatedRenderTime: 0
  NumberOfConsumers: 0
  RenderTimeMultiplier: 1
  Visibility: On
  PropertyKeys: none.
  useBounds: 1
  Layer Number: 0
  PositionCoordinate: 0x254d570
    Debug: Off
    Modified Time: 1001
    Reference Count: 2
    Registered Events: (none)
    Coordinate System: Viewport
    Value: (0,0,0)
    ReferenceCoordinate: (none)
    Viewport: (none)
  Position2 Coordinate: 0x254d640
    Debug: Off
    Modified Time: 1005
    Reference Count: 1
    Registered Events: (none)
    Coordinate System: Normalized Viewport
    Value: (0.5,0.5,0)
    ReferenceCoordinate: 0x254d570
    Viewport: (none)
  Property: 0
  Mapper: 0x2551220
    Debug: Off
    Modified Time: 1193
    Reference Count: 2
    Registered Events: (none)
    Executive: 0x2552210
    ErrorCode: Success
    Information: 0x25516c0
    AbortExecute: Off
    Progress: 0
    Progress Text: (None)
    TimeToDraw: 0
    ClippingPlanes: (none)
    Lookup Table: (none)
    Scalar Visibility: On
    Scalar Mode: Default
    Scalar Range: (0, 1)
    UseLookupTableScalarRange: 0
    Color Mode: Default
    No Transform Coordinate
    Transform Coordinate use double: False

  Input: Text
  Text Property:
    Debug: Off
    Modified Time: 1197
    Reference Count: 1
    Registered Events: (none)
    Color: (1, 1, 1)
    Opacity: 1
    FontFamilyAsString: Arial
    FontFile: (null)
    FontSize: 12
    Bold: Off
    Italic: Off
    Shadow: Off
    ShadowOffset: (1, -1)
    Justification: Left
    Vertical justification: Bottom
    Orientation: 0
    Line Offset: 0
    Line Spacing: 1.1
  Scaled Text Property:
    Debug: Off
    Modified Time: 1199
    Reference Count: 1
    Registered Events: (none)
    Color: (1, 1, 1)
    Opacity: 1
    FontFamilyAsString: Arial
    FontFile: (null)
    FontSize: 12
    Bold: Off
    Italic: Off
    Shadow: Off
    ShadowOffset: (1, -1)
    Justification: Left
    Vertical justification: Bottom
    Orientation: 0
    Line Offset: 0
    Line Spacing: 1.1
  MaximumLineHeight: 1
  MinimumSize: 10 10
  TextScaleMode: 0
  Orientation: 0
  FontScaleExponent: 1
  Texture: 0x254e620
  UseBorderAlign: 0
    Debug: Off
    Modified Time: 1121
    Reference Count: 2
    Registered Events: (none)
    Executive: 0x254efe0
    ErrorCode: Success
    Information: 0x254d1b0
    AbortExecute: Off
    Progress: 0
    Progress Text: (None)
    Interpolate: Off
    Repeat:      On
    EdgeClamp:   Off
    Quality:     Default
    MapColorScalarsThroughLookupTable: Off
    PremultipliedAlpha: Off
    Input: (0x254e010)
    LookupTable: (none)
    Mapped Scalars: (none)
    Transform: (none)
    MultiTexture Blending Mode:     None
    RestrictPowerOf2ImageSmaller:   Off
    Index: 0

Best regards
Torquil Sørensen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20131108/f49ddca9/attachment.htm>


More information about the vtkusers mailing list