[vtk-developers] Performance issue regarding vtkOpenGLGlyph3DMapper with large number of vtkDatasets

Haocheng Liu haocheng.liu at kitware.com
Mon Apr 9 11:20:56 EDT 2018


Hi,

I have a use case that I want to glyph several hundreds of vtkDatasets.
However, the frame rate becomes super slow since vtkOpenGLyph3DMapper would
call rebuildstructures function for each dataset. With 258 vtkDatasets, it
takes more than 4 seconds to render one frame and spends 52% of the time
doing rebuilding stuff(Rebuilding the structure 258 times even though
nothing new!). I'm thinking to remove Line 515 in
/Rendering/OpenGL2/vtkOpenGLGlyph3DMapper.cxx
<https://gitlab.kitware.com/vtk/vtk/blob/master/Rendering/OpenGL2/vtkOpenGLGlyph3DMapper.cxx#L515>
and
pass a flag instead to trigger the rebuilding if a new color is assigned.

--- a/Rendering/OpenGL2/vtkOpenGLGlyph3DMapper.cxx
+++ b/Rendering/OpenGL2/vtkOpenGLGlyph3DMapper.cxx
@@ -368,7 +368,7 @@ void vtkOpenGLGlyph3DMapper::Render(vtkRenderer *ren,
vtkActor *actor)

 //
---------------------------------------------------------------------------
 void vtkOpenGLGlyph3DMapper::Render(
-  vtkRenderer* ren, vtkActor* actor, vtkDataSet* dataset)
+  vtkRenderer* ren, vtkActor* actor, vtkDataSet* dataset, bool
colorChanged)
 {
   vtkIdType numPts = dataset->GetNumberOfPoints();
   if (numPts < 1)
@@ -500,8 +500,15 @@ void vtkOpenGLGlyph3DMapper::Render(

   // rebuild all entries for this DataSet if it
   // has been modified
   if (subarray->BuildTime < dataset->GetMTime() ||
-      subarray->BuildTime < this->GetMTime() ||
+            colorChanged ||
       subarray->BuildTime < this->BlockMTime)
   {
     rebuild = true;


Ideas and suggestions?

Thanks!
-- 
Best regards
Haocheng

Haocheng LIU
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4421 <(518)%20881-4421>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtk-developers/attachments/20180409/9b289073/attachment.html>


More information about the vtk-developers mailing list