[vtkusers] vtkCompositeRenderManager - line streaks

redmod79 michael.j.redmond at gmail.com
Sun Mar 8 15:36:28 EDT 2015


I'm trying to use vtkCompositeRenderManager for parallel rendering large
finite element models.  When using it, there's many line streaks going
across the screen on the node 0 window.  It also clips part of the dataset
when rotating.  This is especially apparent when depth = 1 for create_ugrid.

I'm using vtk 6.2.0.rc1 with Windows 8.1.  A simplified version of the code
is shown below.


##############
import vtk
import sys


def create_ugrid(depth):
    points = vtk.vtkPoints()

    id = 0

    ugrid = vtk.vtkUnstructuredGrid()

    for count in xrange(depth):

        point_ids = [0]*10
        for i in xrange(10):
            point_ids[i] = [0]*10
            for j in xrange(10):
                points.InsertNextPoint((i, j, count))
                point_ids[i][j] = id
                id += 1

        for i in xrange(ugrid.GetNumberOfPoints()):
            vert = vtk.vtkVertex()
            ids = vert.GetPointIds()
            ids.SetId(0, i)
            ugrid.InsertNextCell(vert.GetCellType(), ids)

        for i in xrange(9):
            for j in xrange(9):
                quad = vtk.vtkQuad()
                ids = quad.GetPointIds()

                ids.SetId(0, point_ids[i][j])
                ids.SetId(1, point_ids[i+1][j])
                ids.SetId(2, point_ids[i+1][j+1])
                ids.SetId(3, point_ids[i][j+1])

                ugrid.InsertNextCell(quad.GetCellType(), ids)

    ugrid.SetPoints(points)

    return ugrid

compManager = vtk.vtkCompositeRenderManager()

if compManager.GetController():
    myProcId = compManager.GetController().GetLocalProcessId()
    numProcs = compManager.GetController().GetNumberOfProcesses()

transmitter = vtk.vtkTransmitUnstructuredGridPiece()
transmitter.SetController(compManager.GetController())

controller = compManager.GetController()

if myProcId == 0:
    data = create_ugrid(3)
else:
    data = vtk.vtkUnstructuredGrid()

transmitter.SetInputData(data)
transmitter.UpdateInformation()
transmitter.SetUpdateExtent(myProcId, numProcs, 0)
transmitter.Modified()
transmitter.Update()

geom_filter = vtk.vtkGeometryFilter()
geom_filter.SetInputConnection(transmitter.GetOutputPort())
geom_filter.Modified()
geom_filter.Update()

# create a rendering window and renderer
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.SetSize(300,300)

# create an actor and give it cone geometry
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(geom_filter.GetOutputPort())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor.GetProperty().EdgeVisibilityOn()

# assign our actor to the renderer
ren.AddActor(actor)
ren.SetBackground((0.25, 0.5, 0.25))

renWin.SetWindowName("I am node %d" % myProcId)

if numProcs > 0:
    compManager.SetRenderWindow(renWin)
    compManager.InitializePieces()

#compManager.InitializeOffScreen()

mapper.Update()

def ExitMaster(a, b):
    #print "ExitMaster; I am %d / %d" % ( myProcId, numProcs )
    if numProcs > 1 and myProcId == 0:
        #print "Trigger exit RMI on all satellite nodes"
        for a in range(1, numProcs):
            #print "Trigger exit in satellite node %d" % a
            contr = compManager.GetController()
            contr.TriggerRMI(a, contr.GetBreakRMITag())

if myProcId == 0:
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetInteractorStyle(vtk.vtkInteractorStyleRubberBandPick())
    iren.SetRenderWindow(renWin)
    iren.AddObserver("ExitEvent", ExitMaster)
    iren.Initialize()
    iren.Start()
    #renWin.Render()
    #renWin.Render()
    #renWin.Render()
else:
    compManager.InitializeRMIs()
    compManager.GetController().ProcessRMIs()
    compManager.GetController().Finalize()
    #print "**********************************"
    #print "Done on the slave node"
    #print "**********************************"
    sys.exit()

ExitMaster(0, 0)

#############



--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkCompositeRenderManager-line-streaks-tp5730714.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list