[vtkusers] Problem with font shadow color ?

pof jd379252 at gmail.com
Mon Dec 29 05:49:55 EST 2008


Hello,
still I got the shadow color problem with vtk5.2.0 (was ok with vtk5.0.4),
i.e. the shadow color of text object is actually the same as the text one.
Here below a code that works fine with vtk5.0.4 but which does not with
vtk5.2.0 (in this case the text and the shadow color are red).
Any idea?
jd

int main()
{
    // This creates a polygonal cylinder model with eight 
circumferential facets.
    vtkCylinderSource *cylinder = vtkCylinderSource::New();
    cylinder->SetResolution(8);

    // The mapper is responsible for pushing the geometry into the graphics
    // library. It may also do color mapping, if scalars or other attributes
    // are defined.
    vtkPolyDataMapper *cylinderMapper = vtkPolyDataMapper::New();
    cylinderMapper->SetInputConnection(cylinder->GetOutputPort());

    // The actor is a grouping mechanism: besides the geometry (mapper), it
    // also has a property, transformation matrix, and/or texture map.
    // Here we set its color and rotate it -22.5 degrees.
    vtkActor *cylinderActor = vtkActor::New();
    cylinderActor->SetMapper(cylinderMapper);
    cylinderActor->GetProperty()->SetColor(1.0000, 0.3882, 0.2784);
    cylinderActor->RotateX(30.0);
    cylinderActor->RotateY(-45.0);

    // Create the graphics structure. The renderer renders into the
    // render window. The render window interactor captures mouse events
    // and will perform appropriate camera or actor manipulation
    // depending on the nature of the events.
    vtkRenderer *ren1 = vtkRenderer::New();
    vtkRenderWindow *renWin = vtkRenderWindow::New();

    renWin->AddRenderer(ren1);
    renWin->SetSize(400, 400);

    vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
    iren->SetRenderWindow(renWin);

    // Add the actors to the renderer, set the background and size
    ren1->AddActor(cylinderActor);
    ren1->SetBackground(0.1, 0.2, 0.4);
    renWin->SetSize(400, 400);

    vtkAxesActor* axes2 = vtkAxesActor::New();
    axes2->SetShaftTypeToCylinder();

    vtkOrientationMarkerWidget* widget =     
vtkOrientationMarkerWidget::New();
    widget->SetOrientationMarker( axes2 );

    vtkTextProperty* axisLabelTextProperty = vtkTextProperty::New();
    axisLabelTextProperty->SetFontFamilyToArial();
    axisLabelTextProperty->SetColor( 1.0, 0.0, 0.0 );
    axisLabelTextProperty->SetFontSize( 12 );
    axisLabelTextProperty->ShadowOn();
    
axes2->GetXAxisCaptionActor2D()->SetCaptionTextProperty(axisLabelTextProperty 
);
    
axes2->GetYAxisCaptionActor2D()->SetCaptionTextProperty(axisLabelTextProperty 
);
    
axes2->GetZAxisCaptionActor2D()->SetCaptionTextProperty(axisLabelTextProperty 
);
    axisLabelTextProperty->Delete();

    widget->SetInteractor(iren);
    widget->SetEnabled(1);
    widget->SetInteractive(1);

    // We'll zoom in a little by accessing the camera and invoking a "Zoom"
    // method on it.
    ren1->ResetCamera();
    ren1->GetActiveCamera()->Zoom(1.5);
    renWin->Render();

    // This starts the event loop and as a side effect causes an initial 
render.
    iren->Start();

    // Exiting from here, we have to delete all the instances that
    // have been created.
    cylinder->Delete();
    cylinderMapper->Delete();
    cylinderActor->Delete();
    ren1->Delete();
    renWin->Delete();
    iren->Delete();

    return 0;
}


pof a écrit :
> Hi,
> I'm trying to move my app from vtk5.0.4 to vtk5.2.0.
> At first sight, everything looks ok except that
> shadow color (e.g. for text actors) is no longer managed correctly,
> i.e. the shadow color is actually the same as the text one.
> Has anything changed on this point in the 5.2. branch ?
> Cheers.
> jd
>




More information about the vtkusers mailing list