[vtkusers] Possible VTK bug involving culling?

Lee Gross lmg at amoebatech.com
Thu Nov 19 16:48:15 EST 2009


Below is a Python script which demonstrates a possible VTK culling bug.  It
draws a cube and a legend.  If you edit the script and uncomment the line
which turns on front face culling for the cube, the color bar of the legend
will disappear.  Am I misunderstanding something, or is the culling flag
unintentionally affecting the 2D ScalarBarActor?  Sorry if this is an
already fixed bug.

-- Lee Gross
Amoeba Technologies, Inc.

===================

#!/usr/bin/env python

import vtk

# Create the usual rendering stuff
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

istyle = vtk.vtkInteractorStyleSwitch()
iren.SetInteractorStyle(istyle)
istyle.SetCurrentStyleToTrackballCamera()

# Create a legend
legend = vtk.vtkScalarBarActor()
legend.SetHeight(0.5)
legend.SetWidth(0.15)
legend.SetPosition(0.8, 0.5)
lutDefault = vtk.vtkLookupTable()
nColors = 256
lutDefault.SetNumberOfColors(nColors)
lutDefault.SetTableRange(0., 1.)
lutDefault.Build()
legend.SetLookupTable(lutDefault)
ren.AddActor(legend)

# Create a box
box = vtk.vtkCubeSource()
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(box.GetOutput())
boxActor = vtk.vtkActor()

# If this line is uncommented the legend's colors are not drawn
#boxActor.GetProperty().FrontfaceCullingOn()
boxActor.SetMapper(mapper)

# Add the actor to the renderer, set the background and size
ren.AddActor(boxActor)
ren.SetBackground(0.1, 0.2, 0.2)
renWin.SetSize(500, 500)
ren.ResetCamera()
ren.ResetCameraClippingRange()

iren.Initialize()
renWin.Render()
iren.Start()

===================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091119/cbdce309/attachment.htm>


More information about the vtkusers mailing list