I see 3 possibilities:
- use
actor.GetProperty().RenderPointsAsSpheresOn()
somewhere in your code. - this works for me, using
vtkVertexGlyphFilter
:
import vtk
# Load the data for point cloud and colorized vectors
# nc = vtk.vtkNamedColors()
# test = BTL_GL.BTL_GL()
# pcd, pc, pc_color, MeshGrid, img_color = test.GL_NonFlat()
n = 10
src = vtk.vtkPointSource()
src.SetNumberOfPoints(n)
src.Update()
vgf = vtk.vtkVertexGlyphFilter()
vgf.SetInputData(src.GetOutput())
vgf.Update()
pcd = vgf.GetOutput()
ucols = vtk.vtkUnsignedCharArray()
ucols.SetNumberOfComponents(3)
ucols.SetName("Colors")
for i in range(n):
ucols.InsertNextTuple3(255,i*30,i*30)
pcd.GetPointData().SetScalars(ucols)
# Design the mapper
point_mapper = vtk.vtkPolyDataMapper()
point_mapper.SetInputData(pcd)
actor = vtk.vtkActor()
actor.SetMapper(point_mapper)
actor.GetProperty().SetPointSize(10)
actor.GetProperty().RenderPointsAsSpheresOn()
ren = vtk.vtkRenderer()
ren.SetBackground(.2, .3, .4)
ren.AddActor(actor)
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
# Interactor
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
renderWindowInteractor.SetRenderWindow(renWin)
# Begin Interaction
renWin.Render()
renderWindowInteractor.Start()