[vtk-developers] vtkAssembly does not RenderOverlay

Barth, Sebastian sebastian.barth at iosb.fraunhofer.de
Tue Aug 24 10:21:59 EDT 2010


I've now set up a bug report:
http://www.vtk.org/Bug/view.php?id=11164

Is this problem to simple to get discussed?

-----Ursprüngliche Nachricht-----
Von: vtk-developers-bounces at vtk.org [mailto:vtk-developers-bounces at vtk.org] Im Auftrag von Barth, Sebastian
Gesendet: Dienstag, 24. August 2010 12:25
An: vtk-developers at vtk.org
Betreff: [vtk-developers] vtkAssembly does not RenderOverlay

Hello vtkdevelopers,

I've found a small bug in vtkAssembly and fixed it.

The vtkAssembly of 5.6.0 (I guess the current unstable also) does not have the recursive method:
	int vtkPropAssembly::RenderOverlay(vtkViewport * ren);

Hybrid 2D/3D actors like vtkAxesActor do implement this method to get their 2D data rendered. The vtkAssembly does need this method, too. Not only because of the existence of these classes but rather because of their base class vtkProp3D which only defines the abilities to get positioned and oriented in 3D space and NOT that they are restricted to only render 3D graphics.

E.g. if you don't add this method to vtkAssembly, the vtkAxesActor cannot display its caption labels when it has been added to the a vtkAssembly. 

Here is the code of the method I've added to vtkAssembly.cxx:


// Render this assembly and all its parts. The rendering process is recursive.
int vtkAssembly::RenderOverlay(vtkViewport *ren)
{
  vtkProp3D *prop3D;
  vtkAssemblyPath *path;
  double fraction;
  int   renderedSomething=0;

  // Make sure the paths are up-to-date
  this->UpdatePaths();
  
  // for allocating render time between components
  // simple equal allocation
  fraction = this->AllocatedRenderTime 
    / static_cast<double>(this->Paths->GetNumberOfItems());
  
  vtkCollectionSimpleIterator sit;
  for ( this->Paths->InitTraversal(sit); (path = this->Paths->GetNextPath(sit)); )
    {
    prop3D = static_cast<vtkProp3D *>(path->GetLastNode()->GetViewProp());
    if ( prop3D->GetVisibility() )
      {
      prop3D->SetAllocatedRenderTime(fraction, ren);
      prop3D->PokeMatrix(path->GetLastNode()->GetMatrix());
      renderedSomething += prop3D->RenderOverlay(ren);
      prop3D->PokeMatrix(NULL);
      }
    }

  renderedSomething = (renderedSomething > 0)?(1):(0);

  return renderedSomething;
}


I hope this helps!
Please answer even if you don't plan to add this method. In this case it would be nice to know why.

If your answer is too short, you can fill the mail with a small explanation the reason why not every method in VTK is declared virtual. ;)

Thanks a lot.

Best Regards,
Sebastian Barth
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtk-developers




More information about the vtk-developers mailing list